How to create a new rails app with a slim template as default?

Viewed 449

I was recently introduced to Ruby on Rails and the slim template. As I create a new app using the rails new appname command, under app/views/layouts, there are the erb files such as:application.html.erb. As expected right? Is there any way for me to create a new rails application where instead of an application.html.erb file, it's application.html.slim from the get go?

2 Answers

Just add the slim-rails gem to your Gemfile and then all generated view files will use .slim extension.

It hasn't been updated in 2 years but it still works fine for me on Rails 6.

You can call the following template in the existing app it should setup slim for your app.

rails app:template LOCATION='https://railsbytes.com/script/X8Bska'

There are plenty of other helpful templates which you can use to speed up the setup

 https://railsbytes.com/
Related