2

I am trying to follow this twitter bootstrap tutorial and have run into a small problem

http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec:custom_css

It is clear that bootstrap is being imported (buttons are styled, navbar appears. But, changes that I make in custom.css.scss are not being reflected in my layout. Specifically, I have added

body {
  padding-top: 60px;
}

to try and make it so my navbar doesn't obscure the top part of my page content. This hasn't done anything though. Don't really know what code it would be best to post here for debugging purposes, but here's application.css

*= require_self
*= require_tree .

and I have included

@import "bootstrap";

at the beginning of custom.css.scss.

Is there anything obvious I'm missing here? Thanks for the help.

4
  • When I push my app to Heroku, all works as expected. Don't know if that might provide any clues? Something wrong in development.rb? Commented May 3, 2012 at 6:52
  • 2
    I think it works on Heroku, because Heroku precompiles assests. Try to rake assets:clean. If this fails, try like this: railsapps.github.com/twitter-bootstrap-rails.html Commented May 3, 2012 at 7:18
  • see my comment below... running rake assets:clean didn't work for me... help!? Commented Nov 29, 2012 at 6:42
  • So i had this same issue but what i noticed is that when i first created the custom.css.scss - the file created automatically added a .txt to the extension, but i saw in the video that his file did not that the .txt extension, so i thought this might be the problem. So i thought if i just renamed the file by deleting the .txt it might work, but it didn't. So what i did was just delete the entire file, and re-create it but this time make sure that it originally did not have that .txt extension. This fixed the problem for me :) Commented Dec 16, 2012 at 21:20

3 Answers 3

3

Thank you, Mikhail D!

rake assets:clean

did the trick.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried this, but it didn't work. If i put the style in application.css.scss instead of custom.css.scss it does work. any other ideas?
Try adding config.serve_static_assets = false to your enviroments/development.rb If that doesn't work, and your loading bootstrap from a file called bootstrap_and_overrides.css.scss try removing the line @import "bootstrap"; from application.css.scss if it is included there as well.
0

This sounds weird, but I did the rake assets:clean and then I just named the file test.css.scss and it worked! When I tried to rename to custom.css.scss,then it failed. I am no Ruby expert but this solved my problem.

Comments

0

It depends on ruby version too. If you are using v.2 then try to downgrade to v.1.9. It is very easy if you are using rvm:

To install v.1.9.3 use:

$ rvm install 1.9.3

To use v.1.9.3 as default:

$ rvm --default use 1.9.3

Then

  • restart your terminal
  • install bundler gem
  • run bundle install
  • run rake assets:clean RAILS_ENV=development
  • start your server rails s

That's all.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.