consolidate
Advanced tools
Comparing version 0.1.0 to 0.2.0
0.2.0 / 2012-04-04 | ||
================== | ||
* Added support for dust [fatjonny] | ||
* Added handlebars support [jstewmon] | ||
0.1.0 / 2012-01-03 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -27,3 +27,3 @@ | ||
exports.version = '0.1.0'; | ||
exports.version = '0.2.0'; | ||
@@ -86,2 +86,27 @@ /** | ||
/** | ||
* Dust support. | ||
*/ | ||
exports.dust = function(path, options, fn){ | ||
var engine = requires.dust; | ||
if (!engine) { | ||
engine = requires.dust = require('dust'); | ||
engine.onLoad = function(path, callback) { read(path, options, callback); } | ||
} | ||
read(path, options, function(err, str) { | ||
if (err) return fn(err); | ||
try { | ||
options.filename = path; | ||
engine.renderSource(str, options, function(err, tmpl) { | ||
fn(err, tmpl); | ||
}); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}); | ||
}; | ||
/** | ||
* Swig support. | ||
@@ -275,1 +300,19 @@ */ | ||
}; | ||
/** | ||
* Handlebars support. | ||
*/ | ||
exports.handlebars = function(path, options, fn) { | ||
var engine = requires.handlebars || (requires.handlebars = require('handlebars')); | ||
read(path, options, function(err, str){ | ||
if (err) return fn(err); | ||
try { | ||
options.filename = path; | ||
var tmpl = engine.compile(str, options); | ||
fn(null, tmpl(options)); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}); | ||
} |
{ | ||
"name": "consolidate" | ||
, "version": "0.1.0" | ||
, "version": "0.2.0" | ||
, "description": "Template engine consolidation library" | ||
@@ -23,2 +23,4 @@ , "keywords": ["template", "engine", "view"] | ||
, "hogan.js": "*" | ||
, "dust": "*" | ||
, "handlebars": "*" | ||
} | ||
@@ -25,0 +27,0 @@ , "main": "index" |
@@ -23,2 +23,4 @@ # Consolidate.js | ||
- [hogan](https://github.com/twitter/hogan.js) | ||
- [dust](https://github.com/akdubya/dustjs) | ||
- [handlebars](https://github.com/wycats/handlebars.js/) [(website)](http://handlebarsjs.com/) | ||
@@ -25,0 +27,0 @@ __NOTE__: you must still install the engines you wish to use, add them to your package.json dependencies. |
144
2
12051
16
7
270