Skip to content

Commit

Permalink
Added Support for Twing
Browse files Browse the repository at this point in the history
  • Loading branch information
noel-schenk committed Sep 19, 2019
1 parent ba32aa0 commit fe15dec
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
24 changes: 23 additions & 1 deletion lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,28 @@ exports.squirrelly.render = function(str, options, cb) {
});
};
/**
* expose the instance of the engine - test
* Twing support.
*/

exports.twing = fromStringRenderer('twing');

/**
* Twing string support.
*/

exports.twing.render = function(str, options, cb) {
return promisify(cb, function(cb) {
var engine = requires.twing || (requires.twing = require('twing'));
try {
let rendTmpl = new engine.TwingEnvironment(new engine.TwingLoaderNull).createTemplate(str).render(options);
let tmpl = cache(options) || cache(options, rendTmpl);
cb(null, tmpl);
} catch (err) {
cb(err);
}
});
};
/**
* expose the instance of the engine
*/
exports.requires = requires;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"tinyliquid": "^0.2.30",
"toffee": "^0.1.12",
"twig": "^0.10.0",
"twing": "^2.3.5",
"underscore": "^1.3.3",
"vash": "^0.12.2",
"velocityjs": "^0.8.2",
Expand Down
1 change: 1 addition & 0 deletions test/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ require('./shared').test('razor');
require('./shared').test('squirrelly');
require('./shared/partials').test('squirrelly');
require('./shared/helpers').test('squirrelly');
require('./shared').test('twing');

0 comments on commit fe15dec

Please sign in to comment.