twitter-bootstrap-rails gem workflow

10,109

Solution 1

There is a RailsCasts tutorial that is a great starting point:

http://railscasts.com/episodes/328-twitter-bootstrap-basics

Solution 2

I'm the author of twitter-bootstrap-rails gem. I'll give you a quick walktrough to how to install and use twitter-bootstrap-rails.

Ruby stack; (Ruby 1.9.3, Rails 3.1 or Rails 3.2 is required. Use RVM to get started)

After bundling gem to Gemfile by;

gem 'twitter-bootstrap-rails'

bundle install

Run install generator

rails g bootstrap:install

(it will includes Twitter Bootstrap to your app's asset pipeline)

Run layout generator

rails g bootstrap:layout application fixed

(it will generates layout for you, by default application.html.erb and fixed layout will generates)

Run themed generator (optional);

rails g scaffold post title:string description:text

(this step uses Rails generators to create CRUD stuff for you)

rake db:migrate

(migrating to database)

rails g bootstrap:themed posts

(Twitter Bootstrap compatible styling for your 'posts' views and form)

Also there is detailed documentation to install, usage and generators, coffeescript etc. https://github.com/seyhunak/twitter-bootstrap-rails.

Share:
10,109
AdamT
Author by

AdamT

Updated on June 05, 2022

Comments

  • AdamT
    AdamT almost 2 years

    How do I use the twitter-bootstrap-rails gem in my Rails 3.2.1 app? What is the workflow?

    After I do:

    rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]
    

    what do I do next? Do I just copy and paste the generated code into my view? Do I do this for every view? If so, how is doing

    rails g bootstrap:themed [RESOURCE_NAME] [LAYOUT] [options]
    

    any different?

    Do you guys even use the rails generators?

    Thanks

  • Luca G. Soave
    Luca G. Soave over 12 years
    Yes, I use it too and it's great, I'm very satisfied.
  • MattSlay
    MattSlay over 12 years
    I followed these steps exactly in a new rails app that I started just to test this fancy stuff out. Guess what... It worked PERFECTLY! I like it when simple step-by-step instructions actually bring you to a live, working setup. Thanks Seyhun!
  • Mohamad
    Mohamad about 12 years
    @Seyhun, would you be kind enough to tell us how to update the Boostrap version the gem uses? What If I wnated to use the 2.0.2-wip for example... Do I have to modify the files in the gem?
  • Seyhun Akyürek
    Seyhun Akyürek about 12 years
    @Mohamad No, gem supports latest stable release of the TWB. (you can use old versions too). But not wip release.
  • Roger Garzon Nieto
    Roger Garzon Nieto over 11 years
    You need to add this too: gem 'less-rails' gem 'therubyracer'