问题
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