tauren / tmpl-precompile

Precompile jade templates into executable functions
MIT License
25 stars 7 forks source link

precompiling fails if jade file utilizes "include" #16

Open ghost opened 10 years ago

ghost commented 10 years ago

When I try to precompile .jade files, if I use an include (http://jade-lang.com/reference/#includes) the compilation fails with the following error:

/usr/local/lib/node_modules/tmpl-precompile/node_modules/jade/lib/runtime.js:89 throw err; ^ Error: Jade:1

1| include host

the "filename" option is required to use includes at Object.Parser.parseInclude (/usr/local/lib/node_modules/tmpl-precompile/node_modules/jade/lib/parser.js:304:13) at Object.Parser.parseExpr (/usr/local/lib/node_modules/tmpl-precompile/node_modules/jade/lib/parser.js:169:21) at Object.Parser.parse (/usr/local/lib/node_modules/tmpl-precompile/node_modules/jade/lib/parser.js:114:25) at parse (/usr/local/lib/node_modules/tmpl-precompile/node_modules/jade/lib/jade.js:106:62) at Object.exports.compile (/usr/local/lib/node_modules/tmpl-precompile/node_modules/jade/lib/jade.js:174:10) at Precompiler.compileTemplate (/usr/local/lib/node_modules/tmpl-precompile/lib/tmpl-precompile.js:148:65) at Precompiler.compile (/usr/local/lib/node_modules/tmpl-precompile/lib/tmpl-precompile.js:115:23) at /usr/local/lib/node_modules/tmpl-precompile/lib/tmpl-precompile.js:214:26 at /usr/local/lib/node_modules/tmpl-precompile/node_modules/async/lib/async.js:97:13 at Array.forEach (native)

It seems the issue is that tmpl-precompile does not specify a "filename" or path to include. Possibly adding an option to set include path may resolve this.

ghost commented 10 years ago

It looks like there was a similar fix here... https://github.com/cmoncrief/jadebars/commit/d765f44e268804c5d6ced04dd397c985b3f1564a