component/builder.js — pull request #41 by anthonyshort (2012-12-02 00:19:01+00:00)
Title: Content filters

This allows anyone using builder to register their own content filters without being opinionated. This changes allows someone to register file extensions and pass them through a filter function before they are rendered in the output.

For example, registering '.coffee' filter to allow for writing components in Coffeescript:

```js
builder.registerFilter('.coffee', function (file) {
file.body = coffee.compile(file.body, { filename : file.name });
file.name = file.name.replace('.coffee', '.js');
});
```

You could register filters for template engines as well to automatically compile templates into modules.

While I get why Components are encouraged to be written in pure JS, this change adds enough flexibility for people to write modules in whatever language they want if they're using builder.js directly.

I'll add up some tests and examples when I have some more time.