consolidate
Advanced tools
Comparing version 0.9.1 to 0.10.0
@@ -0,1 +1,8 @@ | ||
0.10.0 / 2013-11-23 | ||
================== | ||
* add lodash support | ||
* add nunjucks support | ||
0.9.1 / 2013-04-29 | ||
@@ -2,0 +9,0 @@ ================== |
@@ -96,2 +96,4 @@ /*! | ||
if (err) return fn(err); | ||
// remove extraneous utf8 BOM marker | ||
str = str.replace(/^\uFEFF/, ''); | ||
if (options.cache) readCache[path] = str; | ||
@@ -524,2 +526,23 @@ fn(null, str); | ||
/** | ||
* Lodash support. | ||
*/ | ||
exports.lodash = fromStringRenderer('lodash'); | ||
/** | ||
* Lodash string support. | ||
*/ | ||
exports.lodash.render = function(str, options, fn) { | ||
var engine = requires.lodash || (requires.lodash = require('lodash')); | ||
try { | ||
var tmpl = cache(options) || cache(options, engine.template(str, null, options)); | ||
fn(null, tmpl(options).replace(/\n$/, '')); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}; | ||
/** | ||
* QEJS support. | ||
@@ -531,7 +554,3 @@ */ | ||
var engine = requires.qejs || (requires.qejs = require('qejs')); | ||
engine.renderFile(path, options).then(function (result) { | ||
fn(null, result); | ||
}, function (err) { | ||
fn(err); | ||
}).end(); | ||
engine.renderFile(path, options).nodeify(fn); | ||
} catch (err) { | ||
@@ -702,3 +721,3 @@ fn(err); | ||
try { | ||
var tmpl = cache(options) || cache(options, engine.compile(str)); | ||
var tmpl = cache(options) || cache(options, engine.compile(str, options && options._def)); | ||
fn(null, tmpl(options)); | ||
@@ -709,1 +728,42 @@ } catch (err) { | ||
}; | ||
/** | ||
* Ractive support. | ||
*/ | ||
exports.ractive = fromStringRenderer('ractive'); | ||
/** | ||
* Ractive string support. | ||
*/ | ||
exports.ractive.render = function(str, options, fn){ | ||
var engine = requires.ractive || (requires.ractive = require('ractive')); | ||
options.template = str; | ||
if (options.data === null || options.data === undefined) | ||
{ | ||
options.data = options; | ||
} | ||
try { | ||
fn(null, new engine(options).renderHTML()); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}; | ||
/** | ||
* Nunjucks support. | ||
*/ | ||
exports.nunjucks = fromStringRenderer('nunjucks'); | ||
/** | ||
* Nunjucks string support. | ||
*/ | ||
exports.nunjucks.render = function(str, options, fn) { | ||
var engine = requires.nunjucks || (requires.nunjucks = require('nunjucks')); | ||
engine.renderString(str, options, fn); | ||
}; |
{ | ||
"name": "consolidate", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"description": "Template engine consolidation library", | ||
@@ -21,2 +21,3 @@ "keywords": [ | ||
"liquor": "0.0.4", | ||
"lodash": "1.2.0", | ||
"hamljs": "0.6.1", | ||
@@ -40,5 +41,11 @@ "whiskers": "0.2.2", | ||
"templayed": ">=0.2.3", | ||
"dot": "1.0.1" | ||
"dot": "1.0.1", | ||
"ractive": "0.3.7", | ||
"nunjucks": "~1.0.0" | ||
}, | ||
"main": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/visionmedia/consolidate.js.git" | ||
}, | ||
"scripts": { | ||
@@ -45,0 +52,0 @@ "test": "mocha" |
@@ -25,4 +25,6 @@ # Consolidate.js | ||
- [liquor](https://github.com/chjj/liquor) | ||
- [lodash](https://github.com/bestiejs/lodash) [(website)](http://lodash.com/) | ||
- [mustache](https://github.com/janl/mustache.js) | ||
- [QEJS](https://github.com/jepso/QEJS) | ||
- [ractive](https://github.com/Rich-Harris/Ractive) | ||
- [swig](https://github.com/paularmstrong/swig) [(website)](http://paularmstrong.github.com/swig/) | ||
@@ -41,3 +43,3 @@ - [templayed](http://archan937.github.com/templayed.js/) | ||
__NOTE__: All this example code uses cons.swig for the swig template engine. Replace swig with whatever templating you are using. For exmaple, use cons.hogan for hogan.js, cons.jade for jade, etc. `console.log(cons)` for the full list of identifiers. | ||
__NOTE__: All this example code uses cons.swig for the swig template engine. Replace swig with whatever templating you are using. For example, use cons.hogan for hogan.js, cons.jade for jade, etc. `console.log(cons)` for the full list of identifiers. | ||
@@ -44,0 +46,0 @@ ```js |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
24006
623
156
1
31