Add this to your
gem 'slim_assets' gem 'ejs' gem 'slim'
You should locate your templates under
app/assets; we suggest
//= require_tree ../templates
The template file
Inside your templates directory, add your template file. The file should be named as follows
- Convert your slim to HTML
- Add the template to the JST global under the templates name
Important! The asset pipeline is not invoking a controller to generate the templates. If you are using existing view templates, you may have to edit templates to remove some references to controller helpers.
In your template file you can use the EJS delimiters as you would normally. If you want to use them in attributes mark the attribute html_safe.
= f.text_field :email, class: 'text', value: '<%= email %>'.html_safe
All the ActionView and route helpers are available in your template. If you use
form_for and the related helpers, you should use the new object form, even if you are writing an edit form, for example
- Les Hill : @leshill
- Wes Gibbs : @wgibbs
This gem is heavily based on their haml_assets gem