Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
731 views
in Technique[技术] by (71.8m points)

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

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?

question from:https://stackoverflow.com/questions/66063738/how-to-create-a-new-rails-app-with-a-slim-template-as-default

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...