Skip to content

Commit e223a27

Browse files
author
小龙
committed
add velocity surport
1 parent ebdeda5 commit e223a27

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lib/consolidate.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,28 @@ function fromStringRenderer(name) {
169169
};
170170
}
171171

172+
/**
173+
* velocity support.
174+
*/
175+
176+
exports.velocityjs = fromStringRenderer('velocityjs');
177+
178+
/**
179+
* velocity string support.
180+
*/
181+
182+
exports.velocityjs.render = function(str, options, fn){
183+
return promisify(fn, function(fn) {
184+
var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
185+
try {
186+
options.locals = options;
187+
fn(null, engine.render(str, options).trimLeft());
188+
} catch (err) {
189+
fn(err);
190+
}
191+
});
192+
};
193+
172194
/**
173195
* Liquid support.
174196
*/

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"underscore": "^1.3.3",
5050
"vash": "^0.8.7",
5151
"walrus": "^0.10.1",
52-
"whiskers": "^0.3.3"
52+
"whiskers": "^0.3.3",
53+
"velocityjs": "^0.8.2"
5354
},
5455
"main": "index",
5556
"repository": {

0 commit comments

Comments
 (0)