Simple connect middleware to serve Jade files as HTML
It provide a simple Connect middleware to serve Jade without locals variables as template HTML files.
This project was created after the drop of native support for Jade in latest Express. More specifically, Express droped the compiler middleware in its versions 2 and 3 (the current versions at the time of this writing).
Read the [annoucement article][annoucement] for more information.
npm install connect-jade-html
Function returning a Connect middleware with the given
selfnamespace to hold the locals (false by default)
localsLocal variable defaults object
filenameUsed in exceptions, and required when using includes
debugOutputs tokens and function body generated
compilerCompiler to replace jade's default
falseno debug instrumentation is compiled
prettyAdd pretty-indentation whitespace to output (false by default)
Here we will setup the middleware with only the required
var jade = require'connect-jade-html';var connect = require'connect';var app = connect;appusejadesrc: __dirnamepretty: true;appuseconnectstatic__dirname + '/public';applisten3000
Pass the middleware to Connect, grabbing "*.jade" files from this directory
and saving .html files to ./public. Also supplying our custom
Following that we have a
static() layer setup to serve the .html
files generated by Jade.
var connectJadeHtml = require'connect-jade-html';var connect = require'connect';var app = connect;appuseconnectJadeHtmlsrc: __dirnamedest: __dirname + '/public'debug: true;appuseconnectstatic__dirname + '/public';