I have following folder structure (simplified):
project - app.js - views - index.jade - layout.jade - public ...
I want to generate an index.html file from index.jade and use the following command in my Terminal (Mac OS X):
jade < index.jade > index.html
However I receive an error saying:
/usr/local/lib/node_modules/jade/lib/runtime.js:231 throw err; ^ Error: Jade:1
1| extends ./layout
2|
3| block mainContent
4| center
the "filename" option is required to use "extends" with "relative" paths at Parser.resolvePath (/usr/local/lib/node_modules/jade/lib/parser.js:464:13) at Parser.parseExtends (/usr/local/lib/node_modules/jade/lib/parser.js:483:21) at Parser.parseExpr (/usr/local/lib/node_modules/jade/lib/parser.js:221:21) at Parser.parse (/usr/local/lib/node_modules/jade/lib/parser.js:122:25) at parse (/usr/local/lib/node_modules/jade/lib/index.js:102:21) at Object.exports.compile (/usr/local/lib/node_modules/jade/lib/index.js:172:16) at ReadStream. (/usr/local/lib/node_modules/jade/bin/jade.js:144:21) at ReadStream.emit (events.js:117:20) at _stream_readable.js:943:16 at process._tickCallback (node.js:419:13)
I tried editing the line which causes the error in index.jade to:
extends layout
and
extends layout.jade
and
extends ./layout.jade
Any idea how I could fix this?
if use "extend" or "include", the filename option must be used.
You have to set
-p
option:You get the error because you are trying with
so jade have troubles finding the path (not sure why I think this is an issue) but if you try
everything will be smooth.
or maybe try some automation with http://gulpjs.com/