在Heroku上将bootstrap-sass bootstrap CSS投入生产

我正在使用我的rails(3.2.5)应用程序中的bootstrap-sass gem,并且在我的本地开发环境中工作得很好。 但是,当我在Heroku上部署prod时,引导程序CSS不包含在已编译的资产中。

我在我的Gemfile中添加了bootstrap-sass和sass-rails:

gem 'bootstrap-sass', '2.0.3.1' group :assets do gem 'sass-rails', '3.2.4' end 

我在Bootstrap中添加了一个导入到我的资产目录中的custom.css文件:

 @import "bootstrap"; 

基本的东西。 知道为什么这不适用于Prod?

您必须在app/assets/stylesheets添加一个bootstrap_and_overrides.css.scss文件:

 // Set the correct sprite paths $iconSpritePath: asset-url('glyphicons-halflings.png', image); $iconWhiteSpritePath: asset-url("glyphicons-halflings-white.png", image); @import "bootstrap"; @import "bootstrap-responsive"; 

此外,您必须添加您的application.js

 //= require bootstrap 

问候!

我遇到了完全相同的问题。 以下是我解决问题的步骤:

  1. 在“* = require_tree”上方添加“* = require bootstrap”。 在application.css中。

  2. 然后我做了“捆绑安装 – 没有生产”

  3. 然后我跑了“rake assets:precompile”

  4. 然后我做了git add。

  5. 然后我提交了更改git commit -m“blah …”

  6. 然后将更改推送到生产“git push heroku master”