I want to include twitter-bootstrap
in one of my rails app.
I added the gem gem twitter-bootstrap-rails
in my Gemfile
. And I did the bundle install.
But I didn't see the bootstrap's css and js files under the assets of my app.
Do I need to generate them?
Or should I simply download latest bootstrap
zip file and add them to my app?
So, I want to know what's the best way to include bootstrap in a rails app.
You need to install bootstrap-sass gem and sass-rails gem. after that rename your application.css file to application.scss and add below code
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
@import "bootstrap-sprockets";
@import "bootstrap";
Please check bootstrap gem github page https://github.com/twbs/bootstrap-sass
look up the bootstrap-sass gem, its more efficient and practical. You d definitely want to use it.
运行捆绑软件安装后,运行引导程序生成器以使用以下命令将Bootstrap包含项添加到资产中:
rails generate bootstrap:install less
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.