【发布时间】:2015-01-04 09:10:05
【问题描述】:
有如下代码application.css.scss:
@import "bootstrap-sprockets";
@import "bootstrap";
/*
* 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 bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
.table tbody > tr > td.vertical-align {
vertical-align: middle;
}
此文件位于“样式表”目录中。同一目录中还有“home.css.scss”文件。但是,如果我将此样式从“应用程序”文件移动到“主”文件,浏览器将看不到这种样式。有什么问题?我该如何解决?谢谢!
【问题讨论】:
-
只需取消注释 application.css.scss 中的
require_tree . -
@CbaBhusal 你在哪里看到
require_tree被评论? -
在您发布的代码中,有 require_tree 注释见
-
@CbaBhusal 没有评论!这是资产清单在 Rails 中编写的方式。首先阅读文档guides.rubyonrails.org/asset_pipeline.html。它在
*= require_self之后有*= require_tree .。 -
我知道你没有评论,但是你可以重写那些。
标签: css ruby-on-rails twitter-bootstrap