Más contenido relacionado Making Peace with Twitter Bootstrap1. Making Peace with
Twitter Bootstrap
Melanie Archer
HTML5 Developer Conference
San Francisco, CA
April 2013
Wednesday, March 27, 2013 1
2. Who’s talking?
Web developer
@mejarc
http://twobanjos.com
Wednesday, March 27, 2013 2
3. Who’s talking?
Slide URL:
http://slidesha.re/Wuboo4
Wednesday, March 27, 2013 3
4. Why bother?
You will have
to deal with it
Photo: Bundesarchiv, B 145 Bild-F024624-0004 / Gräfingholt, Detlef / CC-BY-SA, via Wikimedia Commons
Wednesday, March 27, 2013 4
5. Problems
Bootstrap Bloat
Wednesday, March 27, 2013 5
6. Problems
Bootstrap Bloat
Bootstrap’s Class-itis
Wednesday, March 27, 2013 6
7. Problems
Bootstrap Bloat
Bootstrap’s Class-itis
Bootstrap: inflexible
Wednesday, March 27, 2013 7
9. Bootstrap Bloat
Photo: http://www.flickr.com/photos/wanderlost63
Wednesday, March 27, 2013 9
10. Bootstrap Bloat
The problem might
not be with Bootstrap
Wednesday, March 27, 2013 10
12. Strategies
Customize download
Customize @import
Wednesday, March 27, 2013 12
13. Downloading
The least, first
Wednesday, March 27, 2013 13
14. git clone
https://github.com/
twitter/bootstrap.git
Wednesday, March 27, 2013 14
15. Using LESS
Delete unwanted
@import
Wednesday, March 27, 2013 15
18. gem ‘therubyracer’
gem ‘less-rails’
gem ‘twitter-bootstrap-rails’
Wednesday, March 27, 2013 18
19. Using bower or npm
More LESS
Wednesday, March 27, 2013 19
24. Using SASS
Delete unwanted
@import
Wednesday, March 27, 2013 24
26. $ cd `bundle show bootstrap-sass`
$ cd vendor/assets/stylesheets
$ cp bootstrap.scss ...
$ cp bootstrap/bootstrap.scss ...
Wednesday, March 27, 2013 26
27. git clone
https://github.com/jlong/sass-
twitter-bootstrap.git
Wednesday, March 27, 2013 27
29. Would you like to include
Twitter Bootstrap for
Sass? (Y/n) Y
Wednesday, March 27, 2013 29
33. Treating Bootstrap Bloat
Use Bootstrap in LESS/
SASS components
Copy bootstrap.*
Revise your copy
Wednesday, March 27, 2013 33
37. ! ! <div class="page">
! ! ! <header class="global">
! ! ! ! <h1>My Semantic Markup Fantasy
</h1>
! ! ! </header>
! ! ! <nav class="global">
! ! ! ! <ul>
! ! ! ! ! <li class="active">
! ! ! ! ! ! <a href="#article1">
! ! ! ! ! ! ! Article 1
Wednesday, March 27, 2013 37
39. ! ! <div class="container">
! ! ! <div class="row">
! ! ! ! <div class="span8 page-header"
id="header">
! ! ! ! ! ! <h1>
My Presentational Markup Reality
</h1>
! ! ! ! </div>
! ! ! </div>
! ! ! <div class="row">
! ! ! ! <div class="span12" id="nav">
! ! ! ! ! <ul class="span8 nav nav-pills">
! ! ! ! ! ! <li class="active">
! ! ! ! ! ! ! <a href="#article1">
! ! ! ! ! ! ! ! Article 1
Wednesday, March 27, 2013 39
42. ! ! <div class="page">
! ! ! <header class="global">
! ! ! ! <h1>My Semantic Markup Fantasy
</h1>
! ! ! </header>
! ! ! <nav class="global">
! ! ! ! <ul>
! ! ! ! ! <li class="active">
! ! ! ! ! ! <a href="#article1">
! ! ! ! ! ! ! Article 1
Wednesday, March 27, 2013 42
47. The Plan
Photo: http://www.flickr.com/photos/telstar
Wednesday, March 27, 2013 47
48. The Result
Photo: http://www.flickr.com/photos/caseorganic
Wednesday, March 27, 2013 48
50. .alt {
margin: 10px 5px;
}
.alt.exception {
margin-top: 18px;
}
.alt.exception.just-this-one-time {
margin-top: 0;
}
Wednesday, March 27, 2013 50
52. New process
No more PSDs
Wednesday, March 27, 2013 52
54. //
// Variables
// --------------------------------------------------
// Global values
// --------------------------------------------------
// Grays
// -------------------------
@black: #000;
@grayDarker: #222;
@grayDark: #333;
@gray: #555;
Wednesday, March 27, 2013 54
56. Make peace
Take only what you
need
Wednesday, March 27, 2013 56
57. Make peace
Use your class names
Wednesday, March 27, 2013 57
58. Make peace
Design with Bootstrap,
not against it
Wednesday, March 27, 2013 58
60. Thanks
Bill Fisher
Dave Nugent
Michael Knowles
Angel Inokon
Wednesday, March 27, 2013 60
62. More
BVision, “Please stop embedding Bootstrap classes in your
HTML”
http://ruby.bvision.com/blog/please-stop-embedding-
bootstrap-classes-in-your-html
Roberto Soares, “Integrating Twitter Bootstrap with Ruby
on Rails”
http://blog.robertosoares.me/blog/2012/08/17/
integrating-twitter-bootstrap-with-ruby-on-rails/
Wednesday, March 27, 2013 62
63. More
Mario Noble, “Getting started with SCSS and Bootstrap”
http://www.slideshare.net/marionoble/getting-started-
with-scss-and-bootstrap
Sean Brewer, “How-To: Awesome Web Design with Twitter
Bootstrap”
http://saidigital.co/customize-twitter-bootstrap-4216/
Wednesday, March 27, 2013 63
64. More
Ash Tewari, “Bootstrap With LESS”
http://blog.appliedis.com/2013/02/04/bootstrap-with-
less/
Pat Shaughnessy, “Twitter Bootstrap, Less, and Sass:
Understanding Your Options for Rails 3.1”
http://rubysource.com/twitter-bootstrap-less-and-sass-
understanding-your-options-for-rails-3-1
Wednesday, March 27, 2013 64