html5-boilerplate 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,3 +1,3 @@
1
- Copyright (c) 2010 Peter Gumeson
1
+ Copyright (c) 2010-2011 Peter Gumeson
2
2
 
3
- http://creativecommons.org/licenses/by/3.0/
3
+ http://creativecommons.org/licenses/by/3.0/
data/README.md CHANGED
@@ -2,22 +2,57 @@ Compass Html5 Boilerplate
2
2
  =========================
3
3
 
4
4
  HTML5 Boilerplate is a Compass extension based on HTML5 Boilerplate by Paul Irish.
5
- You can use it to kick-start fully compliant HTML5 applications. Generate either
6
- stand-alone HTML5 projects, or Rails applications with fully integrated HTML5
7
- Haml and Sass (Scss) templates.
5
+ You can use it to kick-start fully compliant HTML5 applications. Setup your Rails
6
+ applications with with fully integrated Haml and Sass/Scss templates that implement
7
+ Boilerplate's functionality, or generate stand-alone Html5 Compass projects.
8
8
 
9
9
  Browse [html5boilerplate.com](http://html5boilerplate.com) for the full workup.
10
10
 
11
+ Features
12
+ =========
13
+ (In addition to Html5 Boilerplate itself)
14
+
15
+ * Html5 Boilerplate stylesheets implemented as a modularized Compass library
16
+ * Lets you pick and choose only the Boilerplate mixins and includes you want
17
+ * Generates sass/scss partials to keep your styleshees organized
18
+ * Generates modularized haml layouts for Rails apps (header, footer, flashes, etc.)
19
+ * Rails helpers to cleanly hide a little of Boilerplate's html complexity
20
+ * Loads minified jQuery in production envs, but uncompressed version in development
21
+ * Rails jquery-ujs driver installed and loaded along with jQuery and Modernizr
22
+ * Setting API Key in google.yml will auto-load jquery from google (async)
23
+ * Setting Analytics ID in google.yml will auto-load google analytics (async)
24
+ * Uses content_for hooks to keep all your javascript and stylesheets in one place
25
+ * Falls back to native Compass for stuff like clearfix and image replacement
26
+ * Fully commented source, but the haml/sass output remains comment free
27
+ * Not tested on animals
28
+
11
29
  Rails Installation
12
30
  ==================
13
31
 
14
- gem install html5-boilerplate
15
- cd my_rails_project
32
+ First, make sure the following gems are in your Gemfile
33
+
34
+ gem "compass"
35
+ gem "haml"
36
+ gem "html5-boilerplate"
37
+
38
+ Then run the following
39
+
40
+ bundle install
16
41
  compass init rails -r html5-boilerplate -u html5-boilerplate --force
17
42
 
18
- **This will install the following files in your rails project:**
19
43
  (Using `--force` flag will overwrite any files that may already exist. In most cases this is probably what you want.)
20
44
 
45
+ (For a new project, I answer "Yes" to keep my stylesheets in app/stylesheets, but "No" for compiling them into public/stylesheets/compiled.)
46
+
47
+ Now remove your application.html.erb so that Haml can do its thing
48
+
49
+ mv apps/views/layouts/application.html.erb apps/views/layouts/application.html.old
50
+
51
+ Start your Rails server, and you're done!
52
+
53
+
54
+ **Here's a list of the files that compass init installed in your Rails project:**
55
+
21
56
  app/views/layouts/application.html.haml
22
57
  app/views/layouts/_flashes.html.haml
23
58
  app/views/layouts/_footer.html.haml
@@ -62,17 +97,14 @@ manually add the following line to the top:
62
97
 
63
98
  require 'html5-boilerplate'
64
99
 
65
- ### A few more minor points...
66
-
67
- If you still have an application.html.erb in your layouts, you will need to loose
68
- it now so that Rails will use your shiny new application.html.haml layout instead.
100
+ ### A few more points...
69
101
 
70
102
  The haml will compile to the equivalent of html5-boilerplate's index.html,
71
103
  but with all comments stripped out, and some additional rails stuff
72
- like csrf_meta_tags, flashes and the Rails jQuery driver.
104
+ like csrf_meta_tags, flashes and the Rails jquery-ujs driver.
73
105
 
74
106
  You can set your own Google Analytics Account ID and your Google API Key
75
- either as ENV variables, or inside config/google.yml.
107
+ either as ENV variables, or inside config/google.yml. (see that file)
76
108
 
77
109
  This extension has only been tested on Rails3.
78
110
 
@@ -80,6 +112,9 @@ This extension has only been tested on Rails3.
80
112
  Stand Alone Installation
81
113
  ========================
82
114
 
115
+ Use this if you're not using Rails, but still want compass and the html5-boilerplate sass libraries,
116
+ It will create a simplified index.html (with haml source), but without the nice Rails helpers.
117
+
83
118
  gem install html5-boilerplate
84
119
  compass create my_project -r html5-boilerplate -u html5-boilerplate --javascripts-dir js --css-dir css
85
120
 
@@ -89,6 +124,7 @@ If you omit them, be sure to edit your javascript and style tags accordingly in
89
124
  **This will create a `my_project` directory containing the following files:**
90
125
 
91
126
  index.html
127
+ index.html.haml
92
128
  404.html
93
129
  crossdomain.xml
94
130
  robots.txt
@@ -124,5 +160,5 @@ License
124
160
  HTML5 Boilerplate by Paul Irish
125
161
  (comments left intact in scss files)
126
162
 
127
- Compass Extension Copyright (c) 2010, Peter Gumeson
163
+ Compass Extension Copyright (c) 2010-2011, Peter Gumeson
128
164
  [http://creativecommons.org/licenses/by/3.0](http://creativecommons.org/licenses/by/3.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -30,6 +30,22 @@ module Html5BoilerplateHelper
30
30
  ENV['GOOGLE_API_KEY'] || google_config(:google_api_key)
31
31
  end
32
32
 
33
+ def remote_jquery(version)
34
+ if Rails.env == 'development'
35
+ "'jquery', '#{version}', {uncompressed:true}"
36
+ else
37
+ "'jquery', '#{version}'"
38
+ end
39
+ end
40
+
41
+ def local_jquery(version)
42
+ if Rails.env == 'development'
43
+ "#{version}/jquery.js"
44
+ else
45
+ "#{version}/jquery.min.js"
46
+ end
47
+ end
48
+
33
49
  private
34
50
 
35
51
  def add_class(name, attrs)
@@ -1,3 +1,11 @@
1
+ // HTML5 Boilerplate
2
+ //
3
+ // Credit is left where credit is due.
4
+ // Much inspiration was taken from these projects:
5
+ // - yui.yahooapis.com/2.8.1/build/base/base.css
6
+ // - camendesign.com/design/
7
+ // - praegnanz.de/weblog/htmlcssjs-kickstart
8
+
1
9
  @import "html5-boilerplate/reset";
2
10
  @import "html5-boilerplate/fonts";
3
11
  @import "html5-boilerplate/styles";
@@ -3,7 +3,7 @@ $base-font-size: 13px !default;
3
3
  $base-line-height: 1.231 !default;
4
4
 
5
5
  //
6
- // Font normalization inspired by from the YUI Library's fonts.css: developer.yahoo.com/yui
6
+ // Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui
7
7
  // Whatever parts of this port of YUI to Sass that are copyrightable, are Copyright (c) 2008, Christopher Eppstein. All Rights Reserved.
8
8
  //
9
9
 
@@ -45,6 +45,11 @@
45
45
  // www.webaim.org/techniques/css/invisiblecontent/ & j.mp/visuallyhidden
46
46
  @mixin visually-hidden {
47
47
  border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;
48
+ // Extends the .visuallyhidden class to allow the element to be focusable
49
+ // when navigated to via the keyboard: drupal.org/node/897638
50
+ &.focusable:active, &.focusable:focus {
51
+ clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto;
52
+ }
48
53
  }
49
54
 
50
55
  // Hide visually and from screenreaders, but maintain layout
@@ -17,8 +17,8 @@
17
17
  }
18
18
 
19
19
  //
20
- // print styles
21
- // inlined to avoid required HTTP connection www.phpied.com/delay-loading-your-print-css/
20
+ // Print styles
21
+ // Inlined to avoid required HTTP connection www.phpied.com/delay-loading-your-print-css/
22
22
 
23
23
  @mixin media-print {
24
24
  * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important;
@@ -26,7 +26,7 @@
26
26
  a, a:visited { color: #444 !important; text-decoration: underline; }
27
27
  a[href]:after { content: " (" attr(href) ")"; }
28
28
  abbr[title]:after { content: " (" attr(title) ")"; }
29
- .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } // don't show links for images, or javascript/internal links
29
+ .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } // Don't show links for images, or javascript/internal links
30
30
  pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
31
31
  thead { display: table-header-group; } // css-discuss.incutio.com/wiki/Printing_Tables
32
32
  tr, img { page-break-inside: avoid; }
@@ -37,8 +37,8 @@
37
37
 
38
38
 
39
39
  //
40
- // media queries for responsive design
41
- // these follow after primary styles so they will successfully override.
40
+ // Media queries for responsive design
41
+ // These follow after primary styles so they will successfully override.
42
42
  //
43
43
 
44
44
  @mixin media-orientation-portrait {
@@ -54,7 +54,7 @@
54
54
  @mixin media-mobile($optimize: true) {
55
55
  // j.mp/textsizeadjust
56
56
  @if not $optimize {
57
- // don't allow iOS and WinMobile to mobile-optimize text
58
- html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; }
57
+ // Don't allow iOS and WinMobile to mobile-optimize text
58
+ html { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; }
59
59
  }
60
60
  }
@@ -1,16 +1,6 @@
1
- //
2
- // style.css contains a reset, font normalization and some base styles.
3
- //
4
- // credit is left where credit is due.
5
- // much inspiration was taken from these projects:
6
- // yui.yahooapis.com/2.8.1/build/base/base.css
7
- // camendesign.com/design/
8
- // praegnanz.de/weblog/htmlcssjs-kickstart
9
- //
10
1
  // html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
11
2
  // v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
12
3
  // html5doctor.com/html-5-reset-stylesheet/
13
- //
14
4
 
15
5
  @mixin html5-boilerplate-reset {
16
6
  html, body, div, span, object, iframe,
@@ -40,17 +30,17 @@
40
30
  blockquote:before, blockquote:after,
41
31
  q:before, q:after { content:''; content:none; }
42
32
 
43
- ins { background-color: #ff9; color: #000; text-decoration:none; }
33
+ ins { background-color: #ff9; color: #000; text-decoration: none; }
44
34
 
45
- mark { background-color: #ff9; color: #000; font-style:italic; font-weight:bold; }
35
+ mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
46
36
 
47
37
  del { text-decoration: line-through; }
48
38
 
49
- abbr[title], dfn[title] { border-bottom:1px dotted; cursor:help; }
39
+ abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
50
40
 
51
- table { border-collapse:collapse; border-spacing:0; }
41
+ table { border-collapse: collapse; border-spacing: 0; }
52
42
 
53
- hr { display: block; height:1px; border:0; border-top:1px solid #ccc; margin:1em 0; padding:0; }
43
+ hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
54
44
 
55
- input, select { vertical-align:middle; }
45
+ input, select { vertical-align: middle; }
56
46
  }
@@ -12,13 +12,8 @@ $list-left-margin: 1.8em !default;
12
12
  //
13
13
 
14
14
  @mixin html5-boilerplate-styles {
15
- body, select, input, textarea { color: $font-color; }
16
-
17
15
  html { @include force-scrollbar; }
18
16
 
19
- a, a:active, a:visited { color: $link-color; }
20
- a:hover { color: $link-hover-color; }
21
-
22
17
  ul, ol { margin-left: $list-left-margin; }
23
18
  ol { list-style-type: decimal; }
24
19
 
@@ -70,7 +65,7 @@ $list-left-margin: 1.8em !default;
70
65
  }
71
66
  }
72
67
 
73
- // align checkboxes, radios, text inputs with their label
68
+ // Align checkboxes, radios, text inputs with their label
74
69
  // by: Thierry Koblentz tjkdesign.com/ez-css/css/base.css
75
70
  @mixin align-input-labels {
76
71
  input[type="radio"] { vertical-align: text-bottom; }
@@ -79,19 +74,19 @@ $list-left-margin: 1.8em !default;
79
74
  .ie6 input { vertical-align: text-bottom; }
80
75
  }
81
76
 
82
- // hand cursor on clickable input elements
77
+ // Hand cursor on clickable input elements
83
78
  @mixin hand-cursor-inputs {
84
79
  label, input[type="button"], input[type="submit"], input[type="image"], button { cursor: pointer; }
85
80
  }
86
81
 
87
- // webkit browsers add a 2px margin outside the chrome of form elements
82
+ // Webkit browsers add a 2px margin outside the chrome of form elements
88
83
  @mixin webkit-reset-form-elements {
89
84
  button, input, select, textarea { margin: 0; }
90
85
  }
91
86
 
92
87
  // These selection declarations have to be separate.
93
88
  // No text-shadow: twitter.com/miketaylr/status/12228805301
94
- // Also: hot pink.
89
+ // Also: hot pink!
95
90
  @mixin selected-text {
96
91
  ::-moz-selection{ background:$selected-background-color; color: $selected-font-color; text-shadow: none; }
97
92
  ::selection { background: $selected-background-color; color: $selected-font-color; text-shadow: none; }
@@ -102,21 +97,21 @@ $list-left-margin: 1.8em !default;
102
97
  a:link { -webkit-tap-highlight-color: $selected-background-color; }
103
98
  }
104
99
 
105
- // always force a scrollbar in non-IE
100
+ // Always force a scrollbar in non-IE
106
101
  @mixin force-scrollbar {
107
102
  overflow-y: scroll;
108
103
  }
109
104
 
110
105
  @mixin ie-hacks {
111
- // make buttons play nice in IE:
106
+ // Make buttons play nice in IE:
112
107
  // www.viget.com/inspire/styling-the-button-element-in-internet-explorer/
113
108
  button { width: auto; overflow: visible; }
114
109
 
115
- // bicubic resizing for non-native sized IMG:
110
+ // Bicubic resizing for non-native sized IMG:
116
111
  // code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
117
112
  .ie7 img { -ms-interpolation-mode: bicubic; }
118
113
 
119
- .ie6 legend, .ie7 legend { margin-left: -7px; } // thnx ivannikolic!
114
+ .ie6 legend, .ie7 legend { margin-left: -7px; }
120
115
  }
121
116
 
122
117
  @mixin no-nav-margins {
@@ -1,11 +1,12 @@
1
- -# Grab Google CDN's jQuery
1
+ -# Grab Google CDN's jQuery, with a protocol relative URL
2
2
  -# Looks for google_api_key first in ENV['GOOGLE_API_KEY'] then in config/google.yml
3
+ -# remote_jquery and local_jquery helpers use minified jquery unless Rails.env is development
3
4
  - if !google_api_key.blank?
4
5
  = javascript_include_tag "//www.google.com/jsapi?key=#{google_api_key}"
5
6
  :javascript
6
- google.load("jquery", "1.4.4");
7
+ google.load(#{ remote_jquery("1.5.1") });
7
8
  - else
8
- = javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"
9
+ = javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/#{ local_jquery("1.5.1") }"
9
10
 
10
11
  -# fall back to local jQuery if necessary
11
12
  :javascript
@@ -15,6 +16,7 @@
15
16
 
16
17
  -# Fix any <img> or .png_bg bg-images. Also, please read goo.gl/mZiyb
17
18
  /[if lt IE 7 ]
19
+ = javascript_include_tag 'dd_belatedpng.js'
18
20
  :javascript
19
21
  //DD_belatedPNG.fix('img, .png_bg');
20
22
 
@@ -1,4 +1,4 @@
1
- -# CSS : implied media="all"
1
+ -# CSS: implied media="all"
2
2
  = stylesheet_link_tag 'style', :media => 'all'
3
3
 
4
4
  -# Uncomment if you are specifically targeting less enabled mobile browsers
@@ -91,13 +91,12 @@ AddEncoding gzip svgz
91
91
  AddType application/vnd.ms-fontobject eot
92
92
  AddType font/truetype ttf
93
93
  AddType font/opentype otf
94
- AddType font/opentype woff
95
- # ^ hack to avoid chrome console warning: crbug.com/70283
94
+ AddType application/x-font-woff woff
96
95
 
97
96
  # assorted types
98
97
  AddType image/x-icon ico
99
98
  AddType image/webp webp
100
- AddType text/cache-manifest manifest
99
+ AddType text/cache-manifest appcache manifest
101
100
  AddType text/x-component htc
102
101
  AddType application/x-chrome-extension crx
103
102
  AddType application/x-xpinstall xpi
@@ -110,8 +109,8 @@ AddType application/octet-stream safariextz
110
109
  # ----------------------------------------------------------------------
111
110
 
112
111
  # e.g. Inside of script.combined.js you could have
113
- # <!--#include file="jquery.js" -->
114
- # <!--#include file="jquery.idletimer.js" -->
112
+ # <!--#include file="libs/jquery-1.5.0.min.js" -->
113
+ # <!--#include file="plugins/jquery.idletimer.js" -->
115
114
  # and they would be included into this single file
116
115
 
117
116
  # this is not in use in the boilerplate as it stands. you may
@@ -183,7 +182,7 @@ AddType application/octet-stream safariextz
183
182
  # Perhaps better to whitelist expires rules? Perhaps.
184
183
  ExpiresDefault "access plus 1 month"
185
184
 
186
- # cache.manifest needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
185
+ # cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
187
186
  ExpiresByType text/cache-manifest "access plus 0 seconds"
188
187
 
189
188
  # your document html
@@ -210,6 +209,9 @@ AddType application/octet-stream safariextz
210
209
  ExpiresByType video/mp4 "access plus 1 month"
211
210
  ExpiresByType video/webm "access plus 1 month"
212
211
 
212
+ # htc files (css3pie)
213
+ ExpiresByType text/x-component "access plus 1 month"
214
+
213
215
  # webfonts
214
216
  ExpiresByType font/truetype "access plus 1 month"
215
217
  ExpiresByType font/opentype "access plus 1 month"
@@ -221,9 +223,11 @@ AddType application/octet-stream safariextz
221
223
  ExpiresByType text/css "access plus 2 months"
222
224
  ExpiresByType application/javascript "access plus 2 months"
223
225
  ExpiresByType text/javascript "access plus 2 months"
226
+
224
227
  <IfModule mod_headers.c>
225
228
  Header append Cache-Control "public"
226
229
  </IfModule>
230
+
227
231
  </IfModule>
228
232
 
229
233
 
@@ -353,6 +357,7 @@ Options -MultiViews
353
357
  # custom 404 page
354
358
  # ----------------------------------------------------------------------
355
359
 
360
+ # You can add custom pages to handle 500 or 403 pretty easily, if you like.
356
361
  ErrorDocument 404 /404.html
357
362
 
358
363
 
@@ -26,7 +26,7 @@
26
26
  -# %link{ :href => "/favicon.ico", :rel => "shortcut icon" }/
27
27
  -# %link{ :href => "/apple-touch-icon.png", :rel => "apple-touch-icon" }/
28
28
 
29
- -# CSS : implied media="all"
29
+ -# CSS: implied media="all"
30
30
  %link{ :href => "css/style.css?v=1", :media => "all", :rel => "stylesheet" }/
31
31
 
32
32
  -# Uncomment if you are specifically targeting less enabled mobile browsers
@@ -43,8 +43,8 @@
43
43
 
44
44
  -#
45
45
  Javascript at the bottom for fast page loading
46
- Grab Google CDN's jQuery. fall back to local if necessary
47
- %script{ :src => "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" }
46
+ Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary
47
+ %script{ :src => "http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" }
48
48
  :javascript
49
49
  !window.jQuery && document.write(unescape('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))
50
50
 
@@ -52,8 +52,9 @@
52
52
  %script{ :src => "js/script.js?v=1" }
53
53
 
54
54
  /[if lt IE 7 ]
55
+ %script{ :src => "js/dd_belatedpng.js" }
55
56
  :javascript
56
- $.getScript("js/dd_belatedpng.js",function(){ DD_belatedPNG.fix('img, .png_bg'); });
57
+ //DD_belatedPNG.fix('img, .png_bg');
57
58
 
58
59
  -# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
59
60
  -# change the UA-XXXXX-X to be your site's ID