Circular dependency error in SCSS file in Rails 3.1 asset pipeline

我们两清 提交于 2019-12-12 20:26:15

问题


I've got application.css.scss in my assets/stylesheets directory, along with a number of controller-specific scss files.

The application.css.scss file has

*= require_self
*= require_tree .

And I have some ordinary scss following these directives. When both require statements are enabled, I get "/app/assets/stylesheets/application.css.scss has already been required." (There is no application.css, I've double-checked.)

Commenting out the *require_tree .* line eliminates the error, but obviously doesn't include the other scss files in the directory. The workaround is to require these files individually but that's not the long term solution. (Taking out the require_self line doesn't eliminate the error, either.)

I had thought Rails was smart enough to resolve this -- I have a feeling I've missed something obvious. Thoughts?


回答1:


You say it doesn't include the other scss files. What are the other scss/css files and did you inserted the *= require_tree . in at least one of them? This would load the application.css file again. I had the same problem. I just removed these lines from all other css/scss files.



来源:https://stackoverflow.com/questions/8702687/circular-dependency-error-in-scss-file-in-rails-3-1-asset-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!