RequireJS Jade plugin that supports client-side Jade rendering, including template inheritance.
require-j attempts to fill the gap left by porting jade over to the client, namely the ability to use template inheritance constructs such as extends and include.
To load templates, jade depends on certain node modules (such as path
and fs
) to exist during runtime and uses require
to access them. The problem is that node's require
is replaced by RequireJS's require
which has no notion of node modules.
To address this issue, require-j overrides jade's default parseInclude and parseExtends functions with a variant that utilizes RequireJS APIs, such as toUrl and fetchText
. This is achieved without any modifications to the jade library.
- Refactor
load
to support dynamic loading from the browser
Initialize jade submodule
$ git submodule init
$ git submodule update
Install dependencies
$ npm install
$ cake build
Will create lib/j.js
and demo/main.out.js
Check out the demo app in demo/ for a sample app utilizing require-j