Skip to content

Commit 97c36e0

Browse files
authored
Merge pull request #284 from fatihky/fatihky-swig-maintained-fork
use swig-templates module
2 parents d0ee1ec + 31007f5 commit 97c36e0

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
- [react](https://github.com/facebook/react)
4040
- [slm](https://github.com/slm-lang/slm)
4141
- [swig (unmaintained)](https://github.com/paularmstrong/swig)
42+
- [swig (maintained fork)](https://github.com/node-swig/swig-templates)
4243
- [teacup](https://github.com/goodeggs/teacup)
4344
- [templayed](http://archan937.github.com/templayed.js/)
4445
- [twig](https://github.com/justjohn/twig.js)

lib/consolidate.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,18 @@ exports.swig = fromStringRenderer('swig');
540540

541541
exports.swig.render = function(str, options, fn){
542542
return promisify(fn, function(fn) {
543-
var engine = requires.swig || (requires.swig = require('swig'));
543+
var engine = requires.swig;
544+
if (!engine) {
545+
try {
546+
engine = requires.swig = require('swig');
547+
} catch (err) {
548+
try {
549+
engine = requires.swig = require('swig-templates');
550+
} catch (otherError) {
551+
throw err;
552+
}
553+
}
554+
}
544555

545556
try {
546557
if(options.cache === true) options.cache = 'memory';

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"react-dom": "^15.3.2",
5757
"should": "*",
5858
"slm": "^0.5.0",
59+
"swig-templates": "^2.0.2",
5960
"swig": "^1.4.1",
6061
"teacup": "^2.0.0",
6162
"templayed": ">=0.2.3",

0 commit comments

Comments
 (0)