Comparing version 0.0.5 to 0.0.6
16
index.js
@@ -8,2 +8,3 @@ /** | ||
var EventEmitter = require("events").EventEmitter; | ||
var loader = require('./lib/loader.js'); | ||
var tags = [ | ||
@@ -56,12 +57,7 @@ "script", | ||
options.loader = options.loader || loader(api, options.views); | ||
var self = this; | ||
var swig = this.swig = new Swig(options); | ||
var origin = this.swig.options.loader.resolve; | ||
this.swig.options.loader.resolve = function(to, from) { | ||
to = api.resolve(to); | ||
return origin.call(this, to, from); | ||
}; | ||
tags.forEach(function (tag) { | ||
@@ -92,2 +88,8 @@ var t = require('./tags/' + tag); | ||
}); | ||
}; | ||
SwigWrap.prototype.destroy = function() { | ||
this.emit('destroy'); | ||
this.removeAllListeners(); | ||
this.swig = null; | ||
}; |
{ | ||
"name": "yog-swig", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "custom swig template, add some tag or filter ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,3 @@ var exports = module.exports; | ||
content.push('</html>'); | ||
var code = '_ctx._yog.setFramework(_ctx._yog.getUri(' + args.pop() + '));' + | ||
var code = '_ctx._yog.setFramework(' + args.pop() + ');' + | ||
compiler(content, parents, options, blockName); | ||
@@ -9,0 +9,0 @@ return code; |
var exports = module.exports; | ||
exports.compile = function(compiler, args, content, parents, options, blockName) { | ||
return '_output += _swig._r().fis.getUri(' + args.shift() + ');'; | ||
return '_output += _ctx._yog.resolve(' + args.shift() + ');'; | ||
}; | ||
@@ -6,0 +6,0 @@ |
14398
18
349
3