在 Heroku 上将 bootstrap-sass bootstrap CSS 投入生产 [英] Getting bootstrap-sass bootstrap CSS into production on Heroku

查看:55
本文介绍了在 Heroku 上将 bootstrap-sass bootstrap CSS 投入生产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 bootstrap-sass gem 与 Rails (3.2.5) 应用程序一起使用,并且在我的本地开发环境中运行良好.但是当我在 Heroku 上部署到 prod 时,引导 CSS 不包含在编译的资产中.

I'm using the bootstrap-sass gem with my rails (3.2.5) app, and things are working great in my local dev environment. But when I deploy to prod on Heroku the bootstrap CSS isn't included in the compiled assets.

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

I added bootstrap-sass and sass-rails to my Gemfile:

gem 'bootstrap-sass', '2.0.3.1'

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

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

And I added an import for Bootstrap to a custom.css file in my assets dir:

@import "bootstrap";

基本的东西.知道为什么这在 Prod 中不起作用吗?

Basic stuff. Any idea why this isn't working in Prod?

推荐答案

你必须在你的 app/assets/stylesheets 中添加一个 bootstrap_and_overrides.css.scss 文件下一个:

You must add a bootstrap_and_overrides.css.scss file in your app/assets/stylesheets with the next:

// 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 中添加:

Also, you must add in your application.js:

//= require bootstrap 

问候!

这篇关于在 Heroku 上将 bootstrap-sass bootstrap CSS 投入生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆