Jade.JS is most popular Node.JS templating framework. This gem gives you ability to easily compile Jade templates at server-side (similar to how the Sprockets .eco engine works).
Gem is supposed to be used with JST engine.
sample.jst.jade:
doctype html
head
title Hello, #{name} :)
body
| Yap, it works
application.js (require runtime.js before templates):
//= require jade/runtime
//= require sample
$('body').html(JST['sample']({name: 'Billy Bonga'}))
Includes don't work with this implementation. A workaround is to use something like
= JST['include/foo']()
This implementation was greatly inspired by two similar gems:
It was developed as a successor to tilt-jade to improve following:
- Add debugging capabilities (slightly different build technique)
- Support exact Jade.JS lib without modifications
- Do not hold 3 copies of Jade.JS internally
- Be well-covered with RSpec
It is free software, and may be redistributed under the terms of MIT license.