Sunday, May 12, 2024
159
rated 0 times [  163] [ 4]  / answers: 1 / hits: 25837  / 13 Years ago, mon, july 4, 2011, 12:00:00

I'd like to use Jade templates client-side. Preferably generated using the Rails 3.1 asset pipeline. I can't really figure out how to do this.



Anyone who've stumbled upon the same problem and found a great solution? Any thoughts are much appreciated.




More From » ruby-on-rails

 Answers
82

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.


[#91357] Saturday, July 2, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pierceabnerc

Total Points: 430
Total Questions: 92
Total Answers: 102

Location: Faroe Islands
Member since Thu, Apr 8, 2021
3 Years ago
;