skip to Main Content

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.

3

Answers


  1. look up the bootstrap-sass gem, its more efficient and practical. You d definitely want to use it.

    Login or Signup to reply.
  2. After running bundle install, run the bootstrap generator to add Bootstrap includes into your assets using the following command:

    rails generate bootstrap:install less
    
    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search