Suraj
Suraj

Reputation: 2553

include twitter bootstrap in a rails app

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.

Upvotes: 0

Views: 69

Answers (3)

Sam Hopkins
Sam Hopkins

Reputation: 1

After running bundle install, run the bootstrap generator to add Bootstrap includes into your assets using the following command:

rails generate bootstrap:install less

Upvotes: 0

Sibin Xavier
Sibin Xavier

Reputation: 306

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

Upvotes: 2

IKEN Lemjahed Ayoub
IKEN Lemjahed Ayoub

Reputation: 104

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

Upvotes: 0

Related Questions