var jrJade = require('jr-jade');
jrJade({
inDir: 'src',
outDir: 'out',
options: {
pretty: true
},
locals: {
name: 'Jade'
}
}, function (err) {
if (err) {
console.log(err);
}
});
Given src/hello.jade:
doctype
html
body
p Hello, #{name}!
this writes out/hello.html:
<!DOCTYPE html>
<html>
<body>
<p>Hello, Jade!</p>
</body>
</html>
Jr-jade is a function that compiles jade files into html files. Although designed to be used with jr, it does not depend on jr and can be used by itself.
All *.jade files in 'inDir' (non-recursive) will be compiled to *.html files in 'outDir' with the same basename. Because 'inDir' is not traversed recursively, jade partials can be stored in subdirectories without generating their own html files.
See the jade public API for details on 'options' and 'locals'.
Jr-jade is a thin wrapper around the jade public API. Jade provides an API to compile jade strings, and a command-line tool to compile jade files, but no API to compile files. Jr-jade fills this gap.