techpines/asset-rack — pull request #48 by noc7c9 (2013-03-07 21:57:07+00:00)
Title: utils.walk method added; DynamicAssets class added; StaticAssets re-implemented to use DynamicAssets

https://github.com/techpines/asset-rack/issues/38

Woo! That was fun :D
Just hope I didn't break anything...
(All the existing tests are passing though.)

So I've added a walk function
```coffee
rack.utils.walk dirname, [options,] iterator [, callback]
```
As you can see I drew from the async api; and it works asynchronously.
Should I make a synchronous version as well?

> Note: in the end I didn't use `wrench-js` due to a few problems making the entire walk function asynchronous

eg:
```coffee
walk '/somedir',
ignoreFolders: true # folders won't be passed to the iterator
filter: 'coffee' # only pass *.coffee files to the iterator; can also be a function
, (file, done) -> # called for each file; done must be called
, (err) -> # called after the last file
```

I've also added DynamicAssets which uses `walk` and StaticAssets now extends DynamicAssets.

```coffee
new DynamicAssets
type: StylusAsset
filter: '.styl'
dirname: '/styl'
url: '/css'
options:
compress: true
config: ->
use nib()
```

---

Also I have a few details I need to clarify.
- While converting StaticAssets I made a class which is basically a single file version of StaticAssets

```
new StylusAsset
url: '/hello-world.txt'
filename: '/path/to/hello-world/file.txt'
```
Should I expose this? It might be useful to some users maybe?

- Should I make StaticAssets style classes for each of the builtin assets? ie. StylusAssets, LessAssets, etc.

- Which of the following styles should I use for passing arbitrary options the asset factory?

```coffee
new DynamicAssets
...
options: # via an options object...
compress: true
```
```coffee
new DynamicAssets
...
compress: true # ...or directly to the constructor?
```

---

I'll be make some tests for the new additions a little later.

PS: Sorry for the wall of text :)