Store#index中的Sprockets :: CircularDependencyError

我正在使用Rails第4版手动Agile Web开发,我在rails 3.1中遇到了sprocket css的问题。

代码css是:

http://media.pragprog.com/titles/rails4/code/rails31/depot_e/app/assets/stylesheets/application.css.scss

如果我修改app / assets / stylesheets / aplication.css.scss的css代码,我会抓住下一个错误:

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:  3:  4: Pragprog Books Online Store 5:  6:  7:  8:  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中的边距值或填充值,例如我得到此错误。

非常感谢你。

您应该删除app / assets / stylesheets / application.css。

我遇到了类似的问题:
资产管道没有预编译sass

当清单文件需要树文件时,会发生循环依赖关系。 无论如何Sass都这样做,所以没有必要。

去掉:

  *= require_tree . 

安装SCSS后我遇到了同样的问题。 我通过删除rails在标题中放置的defult注释来解决问题。 所以这:

 /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the top of the * compiled file, but it's generally better to create a new file per style scope. * *= require_self *= require_tree . */ #wrapper { width: 980px; margin: 0 auto; } 

成为了这个:

 #wrapper { width: 980px; margin: 0 auto; } 

只需将application.css命名为“application.scss”即可。 这将解决您的问题。