Rails 3.1按特定顺序加载css
我看到在rails 3.1的开发环境中,css是按字母顺序加载的,而不是按照我想要的顺序加载。 我想要一个特定的css文件在最后,所以它覆盖了之前给予类的任何样式。 我们怎样才能做到这一点?
最好手动指定每个文件的顺序:
/* * This is a manifest file that'll automatically include all the stylesheets available in this directory * and any sub-directories. 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 reset *= require groups *= require the_last *
你实际上可以这样做:
/* *= require 'reset' *= require_self *= require_tree . */
在您的application.css文件中。 这允许您在树之前指定任意数量的样式表(例如重置),而无需指定每个单独的文件。 复位周围的单引号是可选的。
不试图复活旧线程,只是认为这可能对某些人有所帮助。
- Rails 4.1和Bootstrap 3 glyphicons无法正常工作
- 如何在Rails 3站点中为每个页面设置不同的背景图像?
- 窗口大小改变时调整标题大小
- “使用rails进行敏捷Web开发”一书:未应用CSS
- 未使用的CSS – 你如何清理它?
- 在对custom.css.scss进行微小更改后,Bootstrap无法正常工作
- 如何将css / sass样式表与rails中的视图相关联?
- rake assets:precompile throws Sass :: SyntaxError:“* /”之后的CSS无效
- 要导入的文件未找到或不可读:rails 5.2.0上的bootstrap-sprockets