简体   繁体   中英

Using CSS in html vs html.erb

When I run my .html file there is no problem. There is a styled page. However; when I change .html file to .html.erb it doesn't import the scss file and I see a pure html page. Is there a special import method for .html.erb files? How can I fix this?

There is some rules rules regarding how to easily manage assets.

Include the main stylesheet in your layout :

You'll have to precompile your stylesheet before. For example :

# config/initializers/assets.rb
Rails.application.config.assets.precompile += ['main.scss']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM