CodeSmith
CodeSmith

Reputation: 2243

Rails imports stylesheet files twice

I have a Rails app with the following application.scss.erb file:

<% puts "in application.scss.erb" %>
@import "main";

That's all it does. It just imports a separate app/assets/stylesheets/main.scss.erb file.

Inside the main.scss.erb file, I have this content

<% puts "in main.scss.erb" %>

When I start the rails server in development mode, then visit the home page, I see this output in the console

in application.scss.erb
in main.scss.erb
in main.scss.erb

Why does main appear twice?

Upvotes: 0

Views: 74

Answers (1)

ekr990011
ekr990011

Reputation: 744

Does your application.scss have anything extra in it like :

*= require_tree .

by any chance?

Another thing you can check is to look at your network tab in the browser dev tools and actually see if it is loading / requesting it twice or if something else might be going on.

Upvotes: 3

Related Questions