如何设置 Twitter Bootstrap 和 Ruby Rails

How to set up Twitter Bootstrap with Ruby Rails

您好,我已经 Ruby Rails 在 Mac OSX 上设置了 Homebrew 和 Rbenv。

我现在想试用 Bootstrap 并入该设置,但我不确定如何相应地设置 Bootstrap。

有人有任何建议/设置指南吗?

最简单的就是用twitter-bootstrap-railsgemhttps://github.com/seyhunak/twitter-bootstrap-rails

在您的 Gemfile 中: gem 'bootstrap-sass' 然后 bin/rake 捆绑安装

第 1 步:

您需要在您的 Gemfile 中包含 Bootstrap gem,只需添加以下代码行即可:

gem 'bootstrap-sass'

访问以下 link 了解有关 bootstrap gem 的更多详细信息: https://rubygems.org/gems/bootstrap-sass

第 2 步:

将 gem 添加到 Gemfile 后,您只需 运行 以下命令:

捆绑安装

第 3 步:

现在,您已准备好将 bootstrap 属性导入您的样式表。只需将以下两个 @imports 添加到您的 css/scss:

@导入"bootstrap-sprockets"; @import "bootstrap";

希望对你有用!