0
votes

I am following screencast about twitter bootstrap basics to try to understand bootstrap more, but for some reason when I go to localhost, my app has no styling.

I have tried the steps from github repo https://github.com/seyhunak/twitter-bootstrap-rails as well.

I have also followed instruction from this SO post, but when I added the line *= require bootstrap_and_overrides, it shows FileNotFound error.

Here is what I did, after Rails new app bootstrap_practice:

rails g scaffold Product name price:decimal --skip-stylesheets
rake db:migrate
# added gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' on gemfile (I have also tried just gem 'twitter-bootstrap-rails'
bundle install
rails g bootstrap:install

I checked assets and it has the necessary assets.

Stylesheets (application.css)

*
 *= require_tree .
 *= require_self
 */

JS:

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require turbolinks
//= require_tree .

Lastly, my application.html.erb has

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

I am pretty sure that is everything needed. Why is my application on localhost not styled?

2
I prefer using original gems from creators: https://github.com/twbs/bootstrap-sass it worked great for me..liborza
Super basic question, but what is the difference between twitter-bootstrap-rails gem vs bootstrap-sass gem? Are they essentially doing the same thing (styling), but is the former gem "unofficial" gem?Iggy
Difference is the official gem using SASS but yours using LESS. SASS vs LESSliborza

2 Answers

0
votes

An official SASS repo was released since the railscasts was released. (Rails comes with SASS out the box.)

https://github.com/twbs/bootstrap-sass

The repo by seyhunak is maintained in LESS, which requires therubyracer too.

1
votes

So, I've used twitter-bootstrap a lot of ways in Rails, and my favorite is with the bh gem. Bootstrap Helpers on github.

# Gemfile
gem 'bh'

# application.html.erb
<%= stylesheet_link_tag bootstrap_css %>
<%= stylesheet_link_tag font_awesome_css %>
<%= javascript_include_tag bootstrap_js %>

All the assets are delivered through the CDN.