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.
Jade is designed primarily for server-side templating in node.
All jade files need to be transformed in the HTML. Also don't forget that you need to install other dependencie like express, nodemailer, etc (see requires in the source code). And the application should by available on http://localhost/3000. All Jade templates will be correctly rendered and displayed as HTML.
EJS is way faster than Jade and handlebars. EJS has a really smart error handling mechanism built right into it. It points out to you, the line numbers on which an error has occurred so that you don't end up looking through the whole template file wasting your time in searching for bugs. Simple template tags: <% %>.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With