Store#index 中的链轮::CircularDependencyError
我正在阅读手册《使用 Rails 进行敏捷 Web 开发》第 4 版,并且在 Rails 3.1 中遇到了 sprocket css 的问题。
代码 css 是:
如果我修改css代码app/assets/stylesheets/aplication.css.scss 我发现下一个错误:
Sprockets::CircularDependencyError in Store#index
Showing /home/ubuntu/Desktop/Depot/app/views/layouts/application.html.erb where line #5 raised:
/home/ubuntu/Desktop/Depot/app/assets/stylesheets/application.css.scss has already been required
Extracted source (around line #5):
2: <html>
3: <head>
4: <title>Pragprog Books Online Store</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tag %>
8: </head>
Rails.root: /home/ubuntu/Desktop/Depot
Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:5:in`_app_views_layouts_application_html_erb___1008723970_81658620'
我不明白为什么如果我修改 aplication.css.scss 中的边距值或填充值我收到这个错误。
非常感谢。
I am following the manual Agile Web Development with Rails 4th edition and I have a problem with sprocket css in rails 3.1.
The code css is:
If I modify the css code of app/assets/stylesheets/aplication.css.scss I catch the next error:
Sprockets::CircularDependencyError in Store#index
Showing /home/ubuntu/Desktop/Depot/app/views/layouts/application.html.erb where line #5 raised:
/home/ubuntu/Desktop/Depot/app/assets/stylesheets/application.css.scss has already been required
Extracted source (around line #5):
2: <html>
3: <head>
4: <title>Pragprog Books Online Store</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tag %>
8: </head>
Rails.root: /home/ubuntu/Desktop/Depot
Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:5:in`_app_views_layouts_application_html_erb___1008723970_81658620'
I dont understand why if I modify a margin value or a padding value in aplication.css.scss for example I get this error.
Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该删除 app/assets/stylesheets/application.css。
You should remove app/assets/stylesheets/application.css.
我遇到了类似的问题:
资产管道不预编译 sass
当清单文件需要树文件时,会发生循环依赖。 Sass 无论如何都会这样做,所以没有必要。
消除:
I had a similar problem:
Asset pipeline not precompiling sass
The circular dependency happens when the manifest file requires the tree files. Sass does this anyway so it's not necessary.
Remove:
安装 SCSS 后我也遇到了同样的问题。我通过删除 Rails 在标题中放置的默认注释解决了这个问题。所以这个:
变成了这个:
I was having this same problem after installing SCSS. I fixed the problem by removing the defult comments that rails places in the header. So this:
Became this:
只需将 application.css 命名为“application.scss”即可。这将解决您的问题。
Just name the application.css as "application.scss". This will solve your problem.