Skip to content

Commit

Permalink
Merge pull request #284 from fatihky/fatihky-swig-maintained-fork
Browse files Browse the repository at this point in the history
use swig-templates module
  • Loading branch information
doowb committed Sep 20, 2017
2 parents d0ee1ec + 31007f5 commit 97c36e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- [react](https://github.com/facebook/react)
- [slm](https://github.com/slm-lang/slm)
- [swig (unmaintained)](https://github.com/paularmstrong/swig)
- [swig (maintained fork)](https://github.com/node-swig/swig-templates)
- [teacup](https://github.com/goodeggs/teacup)
- [templayed](http://archan937.github.com/templayed.js/)
- [twig](https://github.com/justjohn/twig.js)
Expand Down
13 changes: 12 additions & 1 deletion lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,18 @@ exports.swig = fromStringRenderer('swig');

exports.swig.render = function(str, options, fn){
return promisify(fn, function(fn) {
var engine = requires.swig || (requires.swig = require('swig'));
var engine = requires.swig;
if (!engine) {
try {
engine = requires.swig = require('swig');
} catch (err) {
try {
engine = requires.swig = require('swig-templates');
} catch (otherError) {
throw err;
}
}
}

try {
if(options.cache === true) options.cache = 'memory';
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"react-dom": "^15.3.2",
"should": "*",
"slm": "^0.5.0",
"swig-templates": "^2.0.2",
"swig": "^1.4.1",
"teacup": "^2.0.0",
"templayed": ">=0.2.3",
Expand Down

0 comments on commit 97c36e0

Please sign in to comment.