Skip to content
yabawock edited this page Dec 16, 2012 · 1 revision

Adding bootstrap-sass-rails to your project is really easy. Depending on the way you set up your project you will need to include one of the following snippets in your stylesheet.

Stylesheets

The recommended way

Given you are using a Sass port of Twitter Bootstrap it is recommended to convert your application.css file to Sass/SCSS. This lets you use all features and customization options provided by the port.

Just add the following line to your application.css.scss:

@import 'twitter/bootstrap';

The Sprockets way

You can have Sprockets compile Twitter Bootstrap by itself and include it in your application.css file. This will make it harder to customize the variables when the need arises, but works just as well for the whole unmodified package.

/*
 *= require twitter/bootstrap
 *= require twitter/bootstrap/_responsive
 */

Javascripts

Including the whole supplement of javascripts provided by Twitter Bootstrap is just a line away. Just add require twitter/bootstrap to the application.js after jQuery has been required and you are good to go:

//= require jquery
//= require twitter/bootstrap

If you are using CoffeeScript you will use a slightly different syntax:

#= require jquery
#= require twitter/bootstrap
Clone this wiki locally