Reputation: 12495
This wiki page explains how to create a directory of Javascript templates that can be accessed from a JST object in the DOM:
https://github.com/marionettejs/backbone.marionette/wiki/Using-jst-templates-with-marionette
JST stands for Javascript Templates. This feature — available by default in Rails 3.1 (see notes)— allows you to distribute your Javascript templates as ready-to-use functions in your scripts.
This mechanism is very useful because it avoids having to download templates asynchronously or to distribute them in the source code of your pages.
(Please refer to the post for further info)
The example template engines given include pairing simple HTML with embedded Javascript and Coffeescript, and HAML files with embedded Coffeescript.
I am wondering if there is a similar template engine available that uses Slim and Coffeescript, that would allow me to achieve the same result.
Upvotes: 1
Views: 1618
Reputation: 12495
For those interested, I have found an engine that does what I was looking for: https://github.com/jfirebaugh/skim
It's specifically for rails projects (for the time being), but enables the creation of Javascript Templates using Slim.
It's similar to haml_coffee (https://github.com/netzpirat/haml_coffee_assets), just uses slim instead of haml
Upvotes: 2