Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.

To use this toolkit with rails, you have two possibilities to include it in your project and use it.

Include the twitter-bootstrap gem from anjlab.

Link: https://github.com/anjlab/bootstrap-rails

Add this to your gemfile and run bundle install:

Update your aapp/assets/stylesheets/pplication.css file

  1. Rename application.css to application.css.scss
  2. Import twitter bootstrap @import "twitter/bootstrap";

Update your app/assets/javascripts/application.js file

 

see this post with various gems: http://stackoverflow.com/questions/10583662/comparison-between-twitter-bootstrap-gems-for-rails

Include Twitter Bootstrap without a gem

  • Download Twitter Bootstrap from http://getbootstrap.com/
  • Copy bootstrap/dist/css/bootstrap.css and bootstrap/dist/css/bootstrap.min.css to vendor/assets/stylesheets
  • Copy bootstrap/dist/js/bootstrap.js and bootstrap/dist/js/bootstrap.min.js to vendor/assets/javascripts

 

Update your aapp/assets/stylesheets/pplication.css file

  1. Rename application.css to application.css.scss
  2. Import twitter bootstrap @import "twitter/bootstrap";

Update your app/assets/javascripts/application.js file

without a gem, you are much more flexible to update twitter bootstrap when necessary. You don’t have to wait until a gem is updated.

 

Sample application.html.erb file

I played a little bit around and this is my file

 

 

 

 

Use Twitter Bootstrap with Ruby on Rails 4
Tagged on:         

Leave a Reply

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers:

Welcome Damir Kusar

Log in

Lost your password?
%d bloggers like this: