【发布时间】:2017-02-11 00:30:33
【问题描述】:
我是 Rails 新手,当我通过添加来添加引导程序时,我正在关注本教程 https://launchschool.com/blog/integrating-rails-and-bootstrap-part-1#css_preprocessors
@import "bootstrap-sprockets"
@import "bootstrap"
在application.css.sass 的最底部,一切正常。但是,我有一行代码
html, body{background:#000;color:#FFF;}
这没有得到尊重。看了一圈才发现是因为我的申请文件:
/*
* 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 any plugin's vendor/assets/stylesheets directory 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 other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*= require custom
*/
@import "bootstrap-sprockets"
@import "bootstrap"
我了解,由于“引导程序”位于最底部,这就是网站使用的 CSS,但是,如果我将其移至顶部或任何其他位置,我会收到错误页面。我还有其他方法可以导入引导程序或覆盖页面吗?
【问题讨论】:
-
如果您使用的是 .sass 语法,那么
html, body { background:#000;color:#FFF; }对一个无效。您也可以参考Bootstrap-SASS 文档了解 Ruby 实现。 -
我想问你是否有更新。谢谢法布里齐奥
标签: css ruby-on-rails twitter-bootstrap