Skip to content

Commit

Permalink
fallback to swig-templates if swig is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihky committed Sep 19, 2017
1 parent c801cdf commit 31007f5
Showing 1 changed file with 12 additions and 1 deletion.
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-templates'));
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

0 comments on commit 31007f5

Please sign in to comment.