Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

twitter-bootstrap-rails gem workflow

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

like image 539
AdamT Avatar asked Feb 02 '12 19:02

AdamT


2 Answers

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.

like image 175
Seyhun Akyürek Avatar answered Nov 01 '22 09:11

Seyhun Akyürek


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

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

like image 30
Cliff Darling Avatar answered Nov 01 '22 07:11

Cliff Darling