1

Ran into an interesting problem and wondered if anyone else has as well.

I'm doing a Rails tutorial and part of the setup is installing the bootstrap-sass gem. The tutorial recommends for installing bootstrap, to rename the existing application.css file to application.css.scss, removing all the contents in that file, and then adding @import "bootstrap";.

I downloaded the tutorial's source code and ran it on my local machine and it works just fine.

However, when I implemented this in my code, no css stylings appeared. No errors appeared in the logs, either, though I noticed there was no GET request for the css occurring. I even went into the source code, clicked the css file and it appeared empty, while all the bootstrap javascript files were not empty.

After a while, I decided to implement bootstrap in the way that several other tutorials had done - I put the application.css.scss file back to its normal application.css file with all of the default contents that appear there, and then created a new file that I called styles.css.scss and put in the @import "bootstrap"; there and it loads it just fine.

I contacted a mentor of the program teaching the tutorial. He downloaded my source code from my github repo and saw exactly what I saw, though his project was working just fine, and no other students of the program had yet reported an issue doing it the way that the tutorial (and the bootstrap-sass docs) suggested.

Has anyone else ever run into this issue?

Jared Rader
  • 850
  • 6
  • 21
  • Sounds like a asset pipeline problem. When you remove everything from the application.css file you are also remove `require_self require_tree .` So rails doesn't compile the bootstrap css files into your application. – ChrisBarthol Nov 05 '13 at 16:59
  • I get that... so you would think that everyone else would run into the same problem, no? But nobody else did :\ And even in their source code [here](https://github.com/Bloc/rails-tutorial/blob/master/app/assets/stylesheets/application.css.scss) they've removed all that, including `require_self require_tree .` – Jared Rader Nov 05 '13 at 17:09
  • could be lots of different things when you're dealing with the asset pipeline, if you could create a github repo of the project that isn't working, someone will be able to tell you what the problem is. – Mike Campbell Nov 05 '13 at 17:20
  • You also need `@import "bootstrap-sprockets"` before `bootstrap` – glebm Aug 12 '14 at 01:55

0 Answers0