Using Jade Templates (jade-lang.com) client-side Using Jade Templates (jade-lang.com) client-side ruby-on-rails ruby-on-rails

Using Jade Templates (jade-lang.com) client-side


If you use browserify you can use this handy jade middleware: jadeify.Then you can just call jadeify("foo.jade", { x : 4, y : 5 }) browser-side after pointing a views directory at the middleware and you get back a jquery handle.


Checkout Blade. It is a Jade-like HTML template engine that is designed for client-side (and server-side) use. There are some other features that you guys might like, as well.

EDIT: But, only for Node.js servers. There is no Ruby implementation at this time.


P.S: Probably right now Substack's answer is better.


browserify

Maybe you can use https://github.com/substack/node-browserify

Browser-side require() for your node modules and npm packages

Just point a javascript file or two at browserify and it will walk the AST to read all your require()s recursively. The resulting bundle has everything you need, including pulling in libraries you might have installed using npm!

Browser

http://jsperf.com/dom-vs-innerhtml-based-templating/53 => The performance isn't that great according to this benchmark => http://gist.github.com/raw/550723/12d176698628e30a1df398c7ac7aea93924e1294/jade.js. But according to TJ it was never supposed to be used in the browser, but node.js instead. In that case it is going to be pretty fast. There are a lot of alternatives which you can use in the browser instead.