3 ms·
One thing that wasn't mentioned was template bundling with sprockets. A hack/workaround was posted at https://gist.github.com/989891 https://gist.github.com/989
by devth 15y ago
One thing that wasn't mentioned was template bundling with sprockets. A hack/workaround was posted at https://gist.github.com/989891 https://gist.github.com/989891 but I would really like to know if there is or will be a recommended way of doing it.
- sstephenson 15y agoThe latest Sprockets beta has JST support, heavily inspired by Jammit's approach. Load either the ejs or eco gem in your app, then put a "foo.jst.ejs" or "foo.jst.eco" in your load path. Require it from JS and you'll be able to access the compiled template as JST["foo"].
- devth 15y agoawesome, thanks!
- daveungerer 15y agoCool! I use a version of haml-js that's been modified to work well in the browser. (https://github.com/wintondeshong/haml-js https://github.com/wintondeshong/haml-js). Jammit allowed me to set the template function as Haml and it just worked, by passing the content of the jst files to the Haml() function. Is there an equivalent in sprockets? UPDATE: As much as I like Haml, I think I'll just switch to eco, since it seems better integrated for now, and... CoffeeScript! Now all I need is haml-coffeescript / eco-haml. Well it turns out this does exist: https://github.com/9elements/haml-coffee https://github.com/9elements/haml-coffee. But I don't know how much work I'd need to do to get it working with the sprockets asset pipeline?