seanmonstar/Shipyard — Issue #29: Improve shipyard.registerExts to allow other templating engines
Author: seanmonstar
Created: 2012-03-03 01:50:57+00:00
State: open
Labels: feature

Shipyard currently cheats a little, so that 0.1 could get out the door. It should provide a system for applications to declare other templating languages to use if they so desire.

Example using Handlebars:

```js
// myapp/lib/handlebars.js
var HB = module.exports = new Class({
Extends: Template,
compile: function compile() {
return this.compiled = handlebars.compile(this.text);
}
});

require.extensions['.handlebars'] = function(module, filename) {
var tpl = new HB(require._load(filename));
module.exports = tpl.compile();
};
```

Then an application's package.json could declare them so Shipyard knows:

```js
{
"name": "myapp",
"shipyard": {
"templates": [ "./lib/handlebars" ]
}
}
```