browjadify-compile
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -18,4 +18,12 @@ module.exports = compile | ||
var fn = jade[hasClientFn ? 'compileClient' : 'compile'](fs.readFileSync(filename), options) | ||
return 'string' === typeof fn ? new Function('return ' + fn)() : fn | ||
if ('string' === typeof fn) fn = new Function('return ' + fn)() | ||
fn.dependencies = listDependentFiles(filename) | ||
return fn | ||
} | ||
function listDependentFiles(filename) { | ||
var parser = new jade.Parser(fs.readFileSync(filename, 'utf8'), filename) | ||
parser.parse() | ||
return parser.dependencies || [] | ||
} |
{ | ||
"name": "browjadify-compile", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "The function browjadify uses to compile jade templates for the browser", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -25,2 +25,7 @@ var compile = require('../compile') | ||
it('should list the dependent jade files as a property on the returned function', function () { | ||
var template = compile(__dirname + '/fixtures/c.jade') | ||
assert.deepEqual([ __dirname + '/fixtures/d.jade' ], template.dependencies) | ||
}) | ||
}) | ||
@@ -27,0 +32,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6135
16
71