【问题标题】:bootswatch-rails theme doesn't work allbootswatch-rails 主题并不适用
【发布时间】:2013-01-05 21:04:59
【问题描述】:

我尝试使用 bootswatch-rails,但效果不佳,例如,按钮显示不正确,不像 bootwatch 网站上那样显示。
我将 bootstrap-sass 和 bootswatch 放入我的 gemfile 并捆绑安装

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'bootswatch-rails', '>=0.2.0'

  gem 'uglifier', '>= 1.0.3'
end
gem 'bootstrap-sass', '>= 2.1.0.0'

在我的 bootstrap_and_overrides.css.scss 文件中看起来像这样

// First import journal variables
@import "bootswatch/cerulean/variables";

// Then bootstrap itself
@import "bootstrap";

// Responsive styles go here in case you want them
@import "bootstrap-responsive";

// And finally bootswatch style itself
@import "bootswatch/cerulean/bootswatch";  

我真的不知道我做错了什么。

【问题讨论】:

  • 您的 application.css 中是否导入了 bootstrap_and_overrides.css.scss?或者以不同的方式问...向我们展示您的 application.css 中的 cmets
  • 我有不同的布局。在这种情况下,我使用 home_layout.html.erb 并创建 home.css.scss。这是文件,bootstrap_and_overrides.css.scss 像@import bootstrap_and_overrides.css.scss 一样包含在内。

标签: ruby-on-rails twitter-bootstrap bootswatch


【解决方案1】:

您是否有其他未考虑的 css 文件被导入,例如scaffold.css(当您通过scaffold 命令生成资源时)?

【讨论】:

  • 我不确定,但作为在黑暗中的镜头,我会尝试将“gem 'bootstrap-sass', '>= 2.1.0.0'” 放入组中:Gemfile 中的资产。我还会注释掉引导响应样式 - 它们有时会妨碍您。
  • 所以我应该把 gem 'bootstrap-sass', '>= 2.1.0.0'" 放在 group :assets 里面吧?
猜你喜欢
  • 2012-11-14
  • 1970-01-01
  • 1970-01-01
  • 2020-11-04
  • 2018-06-07
  • 2014-09-15
  • 1970-01-01
  • 2020-01-22
  • 2019-06-23
相关资源
最近更新 更多