简体   繁体   中英

SCSS files in Ruby on Rails app affecting all HTML.erb views

I am working on different HTML.erb files for different pages of an app, but it seems like the SCSS files for css affect all of my HTML.erb files, even when I call the scss file in only one of the html.erb. Is this how it is supposed to be, or any advice over putting ids for everything? Like for my frontpage.html.erb, I have a SCSS file called frontpage.scss. When I put

<%= stylesheet_link_tag 'frontpage', media: 'all', 'data-turbolinks-track': 'reload' %>

in my scss, it also changes that case for all my other html.erb files.

This might be a simple question, but I would really appreciate some advice, thank you so much!

A similar question was asked here: Problem with scss files affecting more than one view

Unfortunately, this is simply how rails works. The link to the question/answer I provided should adequately explain how it works and how to approach the issue.

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