资产管道app/assets/stylesheets
默认包含您的样式。来自指南: http: //guides.rubyonrails.org/asset_pipeline.html
从 3.1 版本开始,Rails 默认将所有 JavaScript 文件连接到一个主 .js 文件中,并将所有 CSS 文件连接到一个主 .css 文件中。正如您将在本指南后面了解的那样,您可以自定义此策略以按您喜欢的方式对文件进行分组。在生产中,Rails 会在每个文件名中插入一个 MD5 指纹,以便 Web 浏览器缓存该文件。您可以通过更改此指纹来使缓存无效,这会在您更改文件内容时自动发生。
在您的/app/assets/stylesheets
目录中,您应该有一个名为application.css
(注意纯 css 扩展名)的文件,其中应包含以下内容:
/*
* 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 .
*/
另请注意,它应该像那样被注释掉,这是 Rails 读取它的方式。