SlideShare a Scribd company logo
Twitter Bootstrap on Rails
  2011.12.07 Hamamatsu.rb #10 @mackato
@mackato

 I’m a programmer,
not a web designer.
Programmer’s web design
Programmer’s web design
Bootstrap, from Twitter
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.


           http://twitter.github.com/bootstrap/
Layouts


Fixed             Fluid
Typography
Tables
Forms
Navigation
Alerts
Popovers
Twitter Bootstrap for Rails
    https://github.com/seyhunak/twitter-bootstrap-rails


Gemfile
gem 'twitter-bootstrap-rails'



 % bundle install
 % rails generate bootstrap:install
Twitter Bootstrap for Rails
app/assets/javascripts/application.js
//=   require jquery
//=   require jquery_ujs
//=   require twitter/bootstrap
//=   require_tree .


app/assets/stylesheets/application.css
 *= require_self
 *= require twitter/bootstrap
 *= require_tree .
Markup by Hand
<div class="topbar">
  <div class="topbar-inner">
    <div class="container">
       <h3><%= link_to "MyApp", "/" %></h3>
       <ul class="nav">
         <li><%= link_to "Link1", "/path1" %></li>
         <li><%= link_to "Link2", "/path2" %></li>
         <li><%= link_to "Link3", "/path3" %></li>
       </ul>
    </div>
  </div>
</div>
Markup by Hand
<div class="topbar">
  <div class="topbar-inner">
    <div class="container">
       <h3><%= link_to "MyApp", "/" %></h3>
       <ul class="nav">
         <li><%= link_to "Link1", "/path1" %></li>
         <li><%= link_to "Link2", "/path2" %></li>
         <li><%= link_to "Link3", "/path3" %></li>
       </ul>
    </div>
  </div>
</div>



                 bored!!!
Fork it



https://github.com/mackato/twitter-bootstrap-rails
Install
Gemfile
gem 'twitter-bootstrap-rails',
    :git => 'git://github.com/mackato/twitter-bootstrap-rails.git




 % bundle install
Layout generator
% rails g bootstrap:layout --help
Usage:
  rails generate bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
[options]

Runtime options:
  -p, [--pretend]   #   Run but do not   make any changes
  -s, [--skip]      #   Skip files that   already exist
  -q, [--quiet]     #   Supress status   output
  -f, [--force]     #   Overwrite files   that already exist

This generator creates layout file with navigation.
form generator
% rails g bootstrap:form --help
Usage:
  rails generate bootstrap:form MODEL_NAME [DIR_NAME] [options]

Runtime options:
  -p, [--pretend]   #   Run but do not   make any changes
  -s, [--skip]      #   Skip files that   already exist
  -q, [--quiet]     #   Supress status   output
  -f, [--force]     #   Overwrite files   that already exist

This generator creates form partial file for a model.
Demo
Thanks!
ToDo: haml and mongoid support.

More Related Content

What's hot (14)

PDF
BADCamp 2008 Core Crazy
Shaun Haber
 
PDF
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Nicholas Dionysopoulos
 
PDF
User stories - an introduction
Marcus Hammarberg
 
PDF
Plugging into plugins
Josh Harrison
 
PDF
Engines
Fernand Galiana
 
PPTX
Binary Studio Academy PRO. JS course. Lecture 5. Backbone plugins
Binary Studio
 
KEY
Userstories a practical intro
Marcus Hammarberg
 
PPT
August 10th, 2009 Pete De Mulle Twitter
Straight North
 
PPT
FVCP - Facebook , Twitter and Meetup API / Widgets
Pete DuMelle
 
PDF
Become an IA superstar (Chinese version)
John Albin Wilkins
 
PDF
NASW 09 McKenna pdf
marynmck
 
DOCX
نشاط 9
HebaAzmy33
 
PDF
I motion
Fernand Galiana
 
PDF
Job Hunting Under Duress
Matthew McCullough
 
BADCamp 2008 Core Crazy
Shaun Haber
 
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
Nicholas Dionysopoulos
 
User stories - an introduction
Marcus Hammarberg
 
Plugging into plugins
Josh Harrison
 
Binary Studio Academy PRO. JS course. Lecture 5. Backbone plugins
Binary Studio
 
Userstories a practical intro
Marcus Hammarberg
 
August 10th, 2009 Pete De Mulle Twitter
Straight North
 
FVCP - Facebook , Twitter and Meetup API / Widgets
Pete DuMelle
 
Become an IA superstar (Chinese version)
John Albin Wilkins
 
NASW 09 McKenna pdf
marynmck
 
نشاط 9
HebaAzmy33
 
I motion
Fernand Galiana
 
Job Hunting Under Duress
Matthew McCullough
 

Similar to Twitter bootstrap on rails (20)

PDF
Desenvolvimento web com Ruby on Rails (parte 2)
Joao Lucas Santana
 
PPT
Useful Rails Plugins
navjeet
 
KEY
Taking your Web App for a walk
Jens-Christian Fischer
 
KEY
Rails Antipatterns | Open Session with Chad Pytel
Engine Yard
 
PDF
integrasi template admin lte terbaru dengan laravel 7
Adi Nata
 
ODP
HTML 5 Drupalcamp Ireland Dublin 2010
alanburke
 
PPT
Boston Computing Review - Ruby on Rails
John Brunswick
 
PDF
Intro To Mvc Development In Php
funkatron
 
PPT
Quick Start: ActiveScaffold
David Keener
 
PDF
Improve theming with (Twitter) Bootstrap
Andrey Yurtaev
 
PDF
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
 
PDF
Rails 3 overview
Yehuda Katz
 
PPT
Jasig Rubyon Rails
Paul Pajo
 
PDF
Desenvolvimento web com Ruby on Rails (parte 6)
Joao Lucas Santana
 
PDF
Your Custom WordPress Admin Pages Suck
Anthony Montalbano
 
PPT
sbt 0.10 for beginners?
k4200
 
PDF
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
PPTX
Flask – Python
Max Claus Nunes
 
PDF
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Fabio Akita
 
TXT
Xxx
syfwan
 
Desenvolvimento web com Ruby on Rails (parte 2)
Joao Lucas Santana
 
Useful Rails Plugins
navjeet
 
Taking your Web App for a walk
Jens-Christian Fischer
 
Rails Antipatterns | Open Session with Chad Pytel
Engine Yard
 
integrasi template admin lte terbaru dengan laravel 7
Adi Nata
 
HTML 5 Drupalcamp Ireland Dublin 2010
alanburke
 
Boston Computing Review - Ruby on Rails
John Brunswick
 
Intro To Mvc Development In Php
funkatron
 
Quick Start: ActiveScaffold
David Keener
 
Improve theming with (Twitter) Bootstrap
Andrey Yurtaev
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
 
Rails 3 overview
Yehuda Katz
 
Jasig Rubyon Rails
Paul Pajo
 
Desenvolvimento web com Ruby on Rails (parte 6)
Joao Lucas Santana
 
Your Custom WordPress Admin Pages Suck
Anthony Montalbano
 
sbt 0.10 for beginners?
k4200
 
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
Flask – Python
Max Claus Nunes
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Fabio Akita
 
Xxx
syfwan
 
Ad

More from Masakuni Kato (13)

PDF
Hamackathon ideathon 2014.02.22
Masakuni Kato
 
PDF
RubyMotionでiOS開発
Masakuni Kato
 
PDF
スマートフォンを利用した会員カードシステムサービス「Smaca」のご紹介
Masakuni Kato
 
PDF
スターターライセンスではじめるAtlassian開発
Masakuni Kato
 
PDF
Blogging on jekyll
Masakuni Kato
 
PDF
Hamamatsu.rb.20111210
Masakuni Kato
 
PDF
リーン・スタートアップ のためのテスト
Masakuni Kato
 
PDF
Start developing Facebook apps in 13 steps
Masakuni Kato
 
PDF
CoffeeScript in 5mins
Masakuni Kato
 
PDF
浜松Rails3道場 其の四 View編
Masakuni Kato
 
PDF
浜松Rails3道場 其の参 Controller編
Masakuni Kato
 
PDF
浜松Rails3道場 其の弐 Model編
Masakuni Kato
 
PDF
浜松Rails3道場 其の壱 プロジェクト作成〜Rouging編
Masakuni Kato
 
Hamackathon ideathon 2014.02.22
Masakuni Kato
 
RubyMotionでiOS開発
Masakuni Kato
 
スマートフォンを利用した会員カードシステムサービス「Smaca」のご紹介
Masakuni Kato
 
スターターライセンスではじめるAtlassian開発
Masakuni Kato
 
Blogging on jekyll
Masakuni Kato
 
Hamamatsu.rb.20111210
Masakuni Kato
 
リーン・スタートアップ のためのテスト
Masakuni Kato
 
Start developing Facebook apps in 13 steps
Masakuni Kato
 
CoffeeScript in 5mins
Masakuni Kato
 
浜松Rails3道場 其の四 View編
Masakuni Kato
 
浜松Rails3道場 其の参 Controller編
Masakuni Kato
 
浜松Rails3道場 其の弐 Model編
Masakuni Kato
 
浜松Rails3道場 其の壱 プロジェクト作成〜Rouging編
Masakuni Kato
 
Ad

Recently uploaded (20)

PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Designing Production-Ready AI Agents
Kunal Rai
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Biography of Daniel Podor.pdf
Daniel Podor
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 

Twitter bootstrap on rails

  • 1. Twitter Bootstrap on Rails 2011.12.07 Hamamatsu.rb #10 @mackato
  • 2. @mackato I’m a programmer, not a web designer.
  • 5. Bootstrap, from Twitter 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. http://twitter.github.com/bootstrap/
  • 13. Twitter Bootstrap for Rails https://github.com/seyhunak/twitter-bootstrap-rails Gemfile gem 'twitter-bootstrap-rails' % bundle install % rails generate bootstrap:install
  • 14. Twitter Bootstrap for Rails app/assets/javascripts/application.js //= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require_tree . app/assets/stylesheets/application.css *= require_self *= require twitter/bootstrap *= require_tree .
  • 15. Markup by Hand <div class="topbar"> <div class="topbar-inner"> <div class="container"> <h3><%= link_to "MyApp", "/" %></h3> <ul class="nav"> <li><%= link_to "Link1", "/path1" %></li> <li><%= link_to "Link2", "/path2" %></li> <li><%= link_to "Link3", "/path3" %></li> </ul> </div> </div> </div>
  • 16. Markup by Hand <div class="topbar"> <div class="topbar-inner"> <div class="container"> <h3><%= link_to "MyApp", "/" %></h3> <ul class="nav"> <li><%= link_to "Link1", "/path1" %></li> <li><%= link_to "Link2", "/path2" %></li> <li><%= link_to "Link3", "/path3" %></li> </ul> </div> </div> </div> bored!!!
  • 18. Install Gemfile gem 'twitter-bootstrap-rails', :git => 'git://github.com/mackato/twitter-bootstrap-rails.git % bundle install
  • 19. Layout generator % rails g bootstrap:layout --help Usage: rails generate bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options] Runtime options: -p, [--pretend] # Run but do not make any changes -s, [--skip] # Skip files that already exist -q, [--quiet] # Supress status output -f, [--force] # Overwrite files that already exist This generator creates layout file with navigation.
  • 20. form generator % rails g bootstrap:form --help Usage: rails generate bootstrap:form MODEL_NAME [DIR_NAME] [options] Runtime options: -p, [--pretend] # Run but do not make any changes -s, [--skip] # Skip files that already exist -q, [--quiet] # Supress status output -f, [--force] # Overwrite files that already exist This generator creates form partial file for a model.
  • 21. Demo
  • 22. Thanks! ToDo: haml and mongoid support.