Twitter Bootstrap + Rails, how do you integrate and modify it?

216 views Asked by At

How do you customize something like Twitter Bootstrap in a Rails 3.2 app? I have the gem ('bootstrap-sass 3.0.3.0') already. Do I just get a copy of the Sass files and not use the gem at all? I feel like I am missing something here because I have begun to put !important in the CSS of my code. (I'm just trying to change the color of the navbar into a gradient.)

Is there also a way to not use the entire framework? I feel like I don't use some of the components anyway (both CSS and JS).

2

There are 2 answers

3
equivalent8 On BEST ANSWER

in your app/asssets/stylesheets/application.sass

$brand-primary: #829F21 !default
$brand-success: #771965 !default
$brand-warning: #A69E22 !default
$brand-danger:  #d9534f !default
$brand-info:    #5bc0de !default
@import "bootstrap"

list of variables https://github.com/thomas-mcdonald/bootstrap-sass/blob/master/vendor/assets/stylesheets/bootstrap/_variables.scss

important thing is to include those variables before you import bootstrap

if you want to import only parts of bootstrap than (like described on the Readme page) include only parts you want

e.g. in app/assets/javascript/application.js :

//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/dropdown
0
Daryll Santos On

It's just an error on my part. I just didn't copy my code for the static site prototype I built, and I had a copy of _variables.scss in my Rails app. The more you know... T_T