简体   繁体   中英

Bootstrap CSS doesn't display in rails project

I've downloaded the project files from the Treehouse Rails Developer course. Rails Development adventure, Stage 4 : Using AJAX . I managed to get the app working but my bootstrap styling does not display.

The bootstrap files are all in their respective folders.

Here's some code from my application.css :

*= require_self
*= require_tree

body {
padding-top: 40px;
}

.alert {
margin-top: 10px;
}

My application.html.erb does contain the stylesheet link tag :

<%= stylesheet_link_tag "application", :media => "all" %>

I'm running rails v 3.2.6 on OSX Mavericks

Thanks ahead of time for the assistance

Your application.css file should like this:

*= require_self
*= require_tree .

body {
padding-top: 40px;
}

.alert {
margin-top: 10px;
}

The period is important - it means grab all of the stylesheets in the current directory.

I've figured it out :

  1. set config.assets.initialize_on_precompile = true in application.rb
  2. flush the asset pipeline cache by running rake tmp:cache:clear

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM