2

I want newly generated files to be generated in slim, not html.erb

I've converted existing files to slim, but newly generated files aren't being generated in slim. How can I make it so that newly generated files are in slim?

I've already followed the process outlined here https://github.com/slim-template/slim/wiki/Template-Converters-ERB-to-SLIM and here Convert ERB template to SLIM

Newly created files using haml-rails and html2haml get generated in haml properly. But I want this behavior for slim and html2slim as well.

Community
  • 1
  • 1
ahnbizcad
  • 10,491
  • 9
  • 59
  • 85
  • The gems should eg slim-rails. That's all you need as far as generating new files as slim. Conversion requires the other gems in the OP links The accepted answer of this post solves it. http://stackoverflow.com/questions/16455801/ruby-on-rails-make-slim-the-default-template?rq=1 – ahnbizcad Aug 20 '14 at 08:10

2 Answers2

4

Just replace gem 'slim' with gem 'slim-rails' in your Gemfile.

And also you can set slime as default generator in config/application.rb:

 config.generators do |g|
      g.template_engine :slim
  end
Manish Nagdewani
  • 597
  • 1
  • 3
  • 14
2

After doing all the necessary steps to convert, just use the slim-rails gem.

Both the slim-rails gem and the haml-rails gem handle newly generated templates being properly converted to the desired preprocessor language.

ahnbizcad
  • 10,491
  • 9
  • 59
  • 85