How to edit twitter bootstrap files in rails?

3.4k views Asked by At

I'm trying to find the twitter-bootstrap files in my rails app ('bootstrap-sass', '2.0.0'), as I need to make a change directly to the bootstrap-responsive.css file, however, I can't find it.

I have bootstrap up and running, but can't seem to find the bootstrap files. How do I locate the bootstrap-responsive.css file?

Thank you!

2

There are 2 answers

1
Jacob On BEST ANSWER

The bootstap-sass gem uses the Rails 3.2 asset pipeline to inject the necessary stylesheets into your app. The actual stylesheet files are located in the gem installation directory, not in your project itself.

Depending on what you want to change, you can either:

  1. Copy the _bootstrap-responsive.scss file from the gem into your app/assets directory and edit it there.
  2. Customize the necessary Bootstrap variables before loading up Bootstrap in your application.scss file:

    $btnPrimaryBackground: #f00;
    @import "bootstrap";
    
1
Intenex On

Edit: Try looking under

app/assets/stylesheets

Here's an example

https://github.com/joliss/solitr/tree/master/app/assets/stylesheets

I'm not too familiar with the structure of rails apps but did you create a local copy or are you using the bootstrap files being hosted directly by github? You should be able to figure that out by checking one of your launched html pages and viewing the source, looking for something like

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css">

If it's a local page, there should be a directory somewhere in your rails app where the files are stored - perhaps there's a 'static' folder or something similar? Try file-searching for it, good chance you might find it.

(I use Django/Python for web projects but I'll look into Rails a bit and see if I find anything)