consolidate
Advanced tools
Comparing version 0.3.0 to 0.3.1
0.3.1 / 2012-06-28 | ||
================== | ||
* add QEJS support | ||
* add underscore support | ||
* change whiskers to use pre-defined `.__express` | ||
* remove engines. Closes #37 | ||
* remove kernel, cannot comply with our caching | ||
0.3.0 / 2012-04-18 | ||
@@ -3,0 +12,0 @@ ================== |
/*! | ||
* consolidate | ||
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca> | ||
* Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca> | ||
* MIT Licensed | ||
@@ -24,8 +24,2 @@ * | ||
/** | ||
* Library version. | ||
*/ | ||
exports.version = '0.3.0'; | ||
/** | ||
* Require cache. | ||
@@ -106,2 +100,3 @@ */ | ||
options.filename = path; | ||
if (!options.cache) engine.cache = {}; | ||
engine.renderSource(str, options, function(err, tmpl) { | ||
@@ -249,28 +244,3 @@ fn(err, tmpl); | ||
var engine = requires.whiskers || (requires.whiskers = require('whiskers')); | ||
var keys = options.partials ? Object.keys(options.partials) : []; | ||
var pending = keys.length + 1; // +1 for the view | ||
var view; | ||
function render() { | ||
try { | ||
fn(null, engine.render(view, options)); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}; | ||
// load partials | ||
keys.forEach(function(key){ | ||
read(require('path').join(options.settings.views, options.partials[key]), options, function(err, str){ | ||
if (err) return fn(err); | ||
options.partials[key] = str; | ||
--pending || render(); | ||
}); | ||
}); | ||
// load view | ||
read(path, options, function(err, str){ | ||
if (err) return fn(err); | ||
view = str; | ||
--pending || render(); | ||
}); | ||
engine.__express(path, options, fn); | ||
}; | ||
@@ -296,15 +266,2 @@ | ||
/** | ||
* Kernel support. | ||
*/ | ||
exports['kernel'] = function(path, options, fn){ | ||
var engine = requires.kernel || (requires.kernel = require('kernel')); | ||
engine.cacheLifetime = options.cache; | ||
engine(path, function(err, tmpl){ | ||
if (err) return fn(err); | ||
tmpl(options, fn); | ||
}); | ||
}; | ||
/** | ||
* Hogan support. | ||
@@ -331,3 +288,3 @@ */ | ||
exports.handlebars = function(path, options, fn) { | ||
var engine = requires.handlebars || (requires.handlebars = require('handlebars')); | ||
var engine = requires.handlebars || (requires.handlebars = require('handlebars')); | ||
read(path, options, function(err, str){ | ||
@@ -344,1 +301,37 @@ if (err) return fn(err); | ||
} | ||
/** | ||
* Underscore support. | ||
*/ | ||
exports.underscore = function(path, options, fn) { | ||
var engine = requires.underscore || (requires.underscore = require('underscore')); | ||
read(path, options, function(err, str){ | ||
if (err) return fn(err); | ||
try { | ||
options.filename = path; | ||
var tmpl = engine.template(str, null, options); | ||
fn(null, tmpl(options).replace(/\n$/, '')); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}); | ||
} | ||
/** | ||
* QEJS support. | ||
*/ | ||
exports.qejs = function (path, options, fn) { | ||
try { | ||
var engine = requires.qejs || (requires.qejs = require('qejs')); | ||
engine.renderFile(path, options).then(function (result) { | ||
fn(null, result); | ||
}, function (err) { | ||
fn(err); | ||
}).end(); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}; |
{ | ||
"name": "consolidate" | ||
, "version": "0.3.0" | ||
, "description": "Template engine consolidation library" | ||
, "keywords": ["template", "engine", "view"] | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
, "dependencies": {} | ||
, "devDependencies": { | ||
"mocha": "*" | ||
, "should": "*" | ||
, "jade": "*" | ||
, "ejs": "*" | ||
, "eco": "*" | ||
, "swig": "*" | ||
, "jazz": "*" | ||
, "jqtpl": "*" | ||
, "liquor": "*" | ||
, "hamljs": "*" | ||
, "whiskers": "*" | ||
, "haml-coffee": "*" | ||
, "kernel": "*" | ||
, "hogan.js": "*" | ||
, "dust": "*" | ||
, "dustjs-linkedin": "*" | ||
, "handlebars": "*" | ||
} | ||
, "main": "index" | ||
, "engines": { "node": "0.6.x" } | ||
"name": "consolidate", | ||
"version": "0.3.1", | ||
"description": "Template engine consolidation library", | ||
"keywords": [ | ||
"template", | ||
"engine", | ||
"view" | ||
], | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*", | ||
"jade": "0.26.0", | ||
"ejs": "0.7.1", | ||
"eco": "1.1.0-rc-3", | ||
"swig": "0.11.2", | ||
"jazz": "0.0.18", | ||
"jqtpl": "1.1.0", | ||
"liquor": "0.0.4", | ||
"hamljs": "0.6.0", | ||
"whiskers": "0.2.2", | ||
"haml-coffee": "0.6.3", | ||
"hogan.js": "2.0.0", | ||
"dust": "0.3.0", | ||
"dustjs-linkedin": "0.4.0", | ||
"handlebars": "1.0.5beta", | ||
"underscore": "1.3.3", | ||
"qejs": "0.0.1" | ||
}, | ||
"main": "index" | ||
} |
@@ -21,5 +21,6 @@ # Consolidate.js | ||
- [jqtpl](https://github.com/kof/node-jqtpl) [(website)](http://api.jquery.com/category/plugins/templates/) | ||
- [kernel](https://github.com/c9/kernel) | ||
- [liquor](https://github.com/chjj/liquor) | ||
- [QEJS](https://github.com/jepso/QEJS) | ||
- [swig](https://github.com/paularmstrong/swig) [(website)](http://paularmstrong.github.com/swig/) | ||
- [underscore](https://github.com/documentcloud/underscore) [(website)](http://documentcloud.github.com/underscore/) | ||
- [whiskers](https://github.com/gsf/whiskers.js/tree/) | ||
@@ -26,0 +27,0 @@ |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
13105
145
18
284
1