html5-boilerplate 0.1.7 → 0.2.0

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/README.md CHANGED
@@ -28,7 +28,7 @@ Rails Installation
28
28
 
29
29
  app/stylesheets/style.scss
30
30
  app/stylesheets/handheld.scss
31
- app/stylesheets/partials/_defaults.scss
31
+ app/stylesheets/partials/_base.scss
32
32
  app/stylesheets/partials/_example.scss
33
33
  app/stylesheets/partials/_page.scss
34
34
 
@@ -51,6 +51,8 @@ Rails Installation
51
51
 
52
52
  config/compass.rb
53
53
  config/initializers/compass.rb
54
+ config/google.yml
55
+ config/nginx.conf
54
56
 
55
57
  The Scss files above will automatically get compiled to your Sass compilation directory:
56
58
 
@@ -71,7 +73,10 @@ The haml will compile to the equivalent of html5-boilerplate's index.html,
71
73
  but with all comments stripped out, and some additional rails stuff
72
74
  like csrf_meta_tags, flashes and the Rails jQuery driver.
73
75
 
74
- This has only been tested on Rails3, but should work fine on Rails2.
76
+ You can set your own Google Analytics Account ID and your Google API Key
77
+ either as ENV variables, or inside config/google.yml.
78
+
79
+ This extension has only been tested on Rails3.
75
80
 
76
81
 
77
82
  Stand Alone Installation
@@ -94,7 +99,7 @@ If you omit them, be sure to edit your javascript and style tags accordingly in
94
99
 
95
100
  src/style.scss
96
101
  src/handheld.scss
97
- src/partials/_defaults.scss
102
+ src/partials/_base.scss
98
103
  src/partials/_example.scss
99
104
  src/partials/_page.scss
100
105
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.2.0
@@ -0,0 +1,47 @@
1
+ module Html5BoilerplateHelper
2
+ # Create a named haml tag to wrap IE conditional around a block
3
+ # http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
4
+ def ie_tag(name=:body, attrs={}, &block)
5
+ attrs.symbolize_keys!
6
+ haml_concat("<!--[if lt IE 7 ]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->".html_safe)
7
+ haml_concat("<!--[if IE 7 ]> #{ tag(name, add_class('ie7', attrs), true) } <![endif]-->".html_safe)
8
+ haml_concat("<!--[if IE 8 ]> #{ tag(name, add_class('ie8', attrs), true) } <![endif]-->".html_safe)
9
+ haml_concat("<!--[if IE 9 ]> #{ tag(name, add_class('ie9', attrs), true) } <![endif]-->".html_safe)
10
+ haml_concat("<!--[if (gt IE 9)|!(IE)]><!-->".html_safe)
11
+ haml_tag name, attrs do
12
+ haml_concat("<!--<![endif]-->".html_safe)
13
+ block.call
14
+ end
15
+ end
16
+
17
+ def ie_html(attrs={}, &block)
18
+ ie_tag(:html, attrs, &block)
19
+ end
20
+
21
+ def ie_body(attrs={}, &block)
22
+ ie_tag(:body, attrs, &block)
23
+ end
24
+
25
+ def google_account_id
26
+ ENV['GOOGLE_ACCOUNT_ID'] || google_config(:google_account_id) || ''
27
+ end
28
+
29
+ def google_api_key
30
+ ENV['GOOGLE_API_KEY'] || google_config(:google_api_key) || ''
31
+ end
32
+
33
+ private
34
+
35
+ def add_class(name, attrs)
36
+ classes = attrs[:class] || ''
37
+ classes.strip!
38
+ classes = ' ' + classes if !classes.blank?
39
+ classes = name + classes
40
+ attrs.merge(:class => classes)
41
+ end
42
+
43
+ def google_config(key)
44
+ configs = YAML.load_file(File.join(Rails.root, 'config', 'google.yml'))[Rails.env.to_sym] rescue {}
45
+ configs[key]
46
+ end
47
+ end
@@ -1 +1,6 @@
1
- Compass::Frameworks.register("html5-boilerplate", :path => "#{File.dirname(__FILE__)}/..")
1
+ Compass::Frameworks.register("html5-boilerplate", :path => "#{File.dirname(__FILE__)}/..")
2
+
3
+ if defined?(ActionController)
4
+ require File.join(File.dirname(__FILE__), 'app', 'helpers', 'html5_boilerplate_helper')
5
+ ActionController::Base.helper(Html5BoilerplateHelper)
6
+ end
@@ -1,13 +1,13 @@
1
1
  @import "html5-boilerplate/reset";
2
2
  @import "html5-boilerplate/fonts";
3
- @import "html5-boilerplate/base";
3
+ @import "html5-boilerplate/styles";
4
4
  @import "html5-boilerplate/helpers";
5
5
  @import "html5-boilerplate/media";
6
6
 
7
7
  @mixin html5-boilerplate {
8
8
  @include html5-boilerplate-reset;
9
9
  @include html5-boilerplate-fonts;
10
- @include html5-boilerplate-base;
10
+ @include html5-boilerplate-styles;
11
11
  @include html5-boilerplate-helpers;
12
12
  @include html5-boilerplate-media;
13
13
  }
@@ -47,7 +47,7 @@ $base-line-height: 1.231 !default;
47
47
  // .big .bigger
48
48
  // +font-size(18px, 16px)
49
49
  //
50
- // For more information see the table found at http://developer.yahoo.com/yui/fonts/#fontsize
50
+ // For more information see the table found at http://developer.yahoo.com/yui/3/cssfonts/#fontsize
51
51
  @mixin font-size($size, $base-font-size: $base-font-size) {
52
52
  font-size: percentage($size / $base-font-size);
53
53
  }
@@ -1,10 +1,11 @@
1
+ @import "compass/utilities/text/replacement";
2
+ @import "compass/utilities/general/clearfix";
3
+
1
4
  //
2
5
  // Non-semantic helper classes
6
+ // It's better to include these mixins in your own styles
3
7
  //
4
8
 
5
- @import "compass/utilities/text/replacement";
6
- @import "compass/utilities/general/clearfix";
7
-
8
9
  @mixin html5-boilerplate-helpers {
9
10
  .ir { @include image-replacement; }
10
11
 
@@ -53,5 +54,7 @@
53
54
  @mixin invisible { visibility: hidden; }
54
55
 
55
56
  // The Magnificent CLEARFIX
56
- // Now using pie-clearfix from Compass
57
- // since it's exactly the same
57
+ @mixin magnificent-clearfix {
58
+ @warn "The 'magnificent-clearfix' mixin has been deprecated. Use 'pie-clearfix' in compass core instead.";
59
+ @include pie-clearfix;
60
+ }
@@ -11,7 +11,7 @@ $list-left-margin: 1.8em !default;
11
11
  // Minimal base styles
12
12
  //
13
13
 
14
- @mixin html5-boilerplate-base {
14
+ @mixin html5-boilerplate-styles {
15
15
  body, select, input, textarea { color: $font-color; }
16
16
 
17
17
  html { @include force-scrollbar; }
@@ -10,6 +10,8 @@
10
10
  %meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}/
11
11
 
12
12
  %title
13
+ == #{controller.controller_name.titleize} - #{controller.action_name.titleize}
14
+
13
15
  %meta{:content => "", :name => "description"}/
14
16
  %meta{:content => "", :name => "author"}/
15
17
 
@@ -1,5 +1,6 @@
1
1
  -# Grab Google CDN's jQuery
2
- - if defined?(google_api_key) && !google_api_key.blank?
2
+ -# Looks for google_api_key first in ENV['GOOGLE_API_KEY'] then in config/google.yml
3
+ - if !google_api_key.blank?
3
4
  = javascript_include_tag "http://www.google.com/jsapi?key=#{google_api_key}"
4
5
  :javascript
5
6
  google.load("jquery", "1.4.2");
@@ -23,14 +24,13 @@
23
24
  = javascript_include_tag 'profiling/yahoo-profiling.min', 'profiling/config'
24
25
 
25
26
  -# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
26
- -# define a google_account_id helper that returns your site's ID
27
- - if defined?(google_account_id) && !google_account_id.blank?
28
- :javascript
29
- var _gaq = [['_setAccount', '#{google_account_id}'], ['_trackPageview']];
30
- (function(d, t) {
31
- var g = d.createElement(t),
32
- s = d.getElementsByTagName(t)[0];
33
- g.async = true;
34
- g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
35
- s.parentNode.insertBefore(g, s);
36
- })(document, 'script');
27
+ -# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/google.yml
28
+ :javascript
29
+ var _gaq = [['_setAccount', '#{google_account_id}'], ['_trackPageview']];
30
+ (function(d, t) {
31
+ var g = d.createElement(t),
32
+ s = d.getElementsByTagName(t)[0];
33
+ g.async = true;
34
+ g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
35
+ s.parentNode.insertBefore(g, s);
36
+ })(document, 'script');
@@ -1,15 +1,14 @@
1
1
  !!! 5
2
+ -#
3
+ Use the ie_html tag below instead of the %html tag if you prefer
4
+ the IE conditionals on the HTML tag instead of the body tag
5
+ http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
6
+
7
+ -# ie_html :lang => 'en', :class => 'no-js' do
2
8
  %html.no-js{:lang => "en"}
3
9
  = render :partial => 'layouts/head'
4
-
5
- -# paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
6
- <!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
7
- <!--[if IE 7 ]> <body class="ie7"> <![endif]-->
8
- <!--[if IE 8 ]> <body class="ie8"> <![endif]-->
9
- <!--[if IE 9 ]> <body class="ie9"> <![endif]-->
10
- <!--[if (gt IE 9)|!(IE)]><!-->
11
- %body
12
- <!--<![endif]-->
10
+
11
+ - ie_body :class => "#{controller.controller_name}" do
13
12
  #container
14
13
  %header#header
15
14
  = render :partial => 'layouts/header'
@@ -18,6 +17,6 @@
18
17
  = yield
19
18
  %footer#footer
20
19
  = render :partial => 'layouts/footer'
21
-
20
+
22
21
  -# Javascript at the bottom for fast page loading
23
22
  = render :partial => 'layouts/javascripts'
@@ -0,0 +1,18 @@
1
+ # Html5BoilerplateHelper will first check your ENV
2
+ # for each key before using the these yml values
3
+ # e.g. ENV['GOOGLE_ACCOUNT_ID'] || :google_account_id
4
+ defaults: &defaults
5
+ :google_account_id: 'UA-XXXXX-X' # ENV['GOOGLE_ACCOUNT_ID']
6
+ :google_api_key: '' # ENV['GOOGLE_API_KEY']
7
+
8
+ :development:
9
+ <<: *defaults
10
+
11
+ :test:
12
+ <<: *defaults
13
+
14
+ :staging:
15
+ <<: *defaults
16
+
17
+ :production:
18
+ <<: *defaults
@@ -16,6 +16,10 @@
16
16
  </IfModule>
17
17
  </IfModule>
18
18
 
19
+ # Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
20
+ # We need to inform proxies that content changes based on UA
21
+ Header append Vary User-Agent
22
+
19
23
 
20
24
  # hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
21
25
  # Disabled. Uncomment to serve cross-domain ajax requests
@@ -49,8 +53,8 @@ AddEncoding gzip svgz
49
53
 
50
54
  # webfonts
51
55
  AddType application/vnd.ms-fontobject eot
52
- AddType font/ttf ttf
53
- AddType font/otf otf
56
+ AddType font/truetype ttf
57
+ AddType font/opentype otf
54
58
  AddType font/woff woff
55
59
 
56
60
  AddType text/cache-manifest manifest
@@ -1,8 +1,8 @@
1
1
  description "Compass extention for HTML5 Boilerplate located at http://html5boilerplate.com"
2
2
 
3
- stylesheet 'style.scss', :media => 'screen, projection'
3
+ stylesheet 'style.scss', :media => 'all'
4
4
  stylesheet 'handheld.scss', :media => 'handheld'
5
- stylesheet 'partials/_defaults.scss'
5
+ stylesheet 'partials/_base.scss'
6
6
  stylesheet 'partials/_example.scss'
7
7
  stylesheet 'partials/_page.scss'
8
8
 
@@ -14,6 +14,7 @@ if Compass.configuration.project_type == :rails
14
14
  file '_header.html.haml', :to => 'app/views/layouts/_header.html.haml'
15
15
  file '_javascripts.html.haml', :to => 'app/views/layouts/_javascripts.html.haml'
16
16
  file '_stylesheets.html.haml', :to => 'app/views/layouts/_stylesheets.html.haml'
17
+ file 'files/google.yml', :to => 'config/google.yml'
17
18
  file 'files/nginx.conf', :to => 'config/nginx.conf'
18
19
  javascript 'javascripts/dd_belatedpng.js', :to => 'dd_belatedpng.js'
19
20
  javascript 'javascripts/jquery-1.4.2.min.js', :to => 'jquery-1.4.2.min.js'
@@ -0,0 +1,23 @@
1
+ // This file must be imported before loading html5-boilerplate
2
+
3
+ $base-font-family: unquote('sans-serif'); // default font-family
4
+
5
+ $base-font-size: 13px; // default font-size for YUI fonts
6
+
7
+ $base-line-height: 1.231; // default line-height for YUI fonts
8
+
9
+ $font-color: #444;
10
+
11
+ $link-color: #607890;
12
+
13
+ $link-hover-color: #036;
14
+
15
+ $link-active-color: #607890;
16
+
17
+ $link-visited-color: #607890;
18
+
19
+ $selected-font-color: #fff; // color for selected text
20
+
21
+ $selected-background-color: #ff5E99; // bg-color for selected text
22
+
23
+ $list-left-margin: 1.8em; // left margin for ul an ol
@@ -54,7 +54,7 @@ sup { @include sup; }
54
54
  .visuallyhidden { @include visually-hidden; }
55
55
 
56
56
  .clearfix {
57
- @include pie-clearfix; // Already defined by compass
57
+ @include pie-clearfix; // defined by compass core
58
58
  }
59
59
 
60
60
 
@@ -6,7 +6,7 @@
6
6
  //-----------------------------------------------
7
7
 
8
8
  h1, h2, h3, h4, h5, h6 {
9
- // This might not be the best choice if you are
9
+ // Bold might not be the best choice if you are
10
10
  // embedding font faces that are already bold
11
11
  font-weight: bold;
12
12
  }
@@ -16,7 +16,9 @@ strong, th {
16
16
  }
17
17
 
18
18
  small {
19
- @include font-size(11px); // This is approx 85%
19
+ // Use font-size mixin to convert to percentage for YUI
20
+ // http://developer.yahoo.com/yui/3/cssfonts/#fontsize
21
+ @include font-size(11px); // approx 85% when base-font-size eq 13px
20
22
  }
21
23
 
22
24
  // Add the 'required' attribute on your
@@ -1,8 +1,7 @@
1
1
  // First, set some default constants
2
- // to be used by html5-boilerplate
3
- @import "partials/defaults";
2
+ @import "partials/base";
4
3
 
5
- // Then, we'll import the compass extension
4
+ // Then we'll import the compass extension
6
5
  @import "html5-boilerplate";
7
6
 
8
7
  // Now you can choose to include the whole
@@ -13,7 +12,7 @@
13
12
  // sections you want to include
14
13
  //@include html5-boilerplate-reset;
15
14
  //@include html5-boilerplate-fonts;
16
- //@include html5-boilerplate-base;
15
+ //@include html5-boilerplate-styles;
17
16
  //@include html5-boilerplate-helpers;
18
17
  //@include html5-boilerplate-media;
19
18
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 7
9
- version: 0.1.7
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Peter Gumeson
@@ -45,14 +45,15 @@ files:
45
45
  - LICENSE
46
46
  - VERSION
47
47
  - templates/project/files/htaccess
48
+ - lib/app/helpers/html5_boilerplate_helper.rb
48
49
  - lib/html5-boilerplate.rb
49
50
  - stylesheets/_html5-boilerplate.scss
50
- - stylesheets/html5-boilerplate/_base.scss
51
51
  - stylesheets/html5-boilerplate/_fonts.scss
52
52
  - stylesheets/html5-boilerplate/_handheld.scss
53
53
  - stylesheets/html5-boilerplate/_helpers.scss
54
54
  - stylesheets/html5-boilerplate/_media.scss
55
55
  - stylesheets/html5-boilerplate/_reset.scss
56
+ - stylesheets/html5-boilerplate/_styles.scss
56
57
  - templates/project/_flashes.html.haml
57
58
  - templates/project/_footer.html.haml
58
59
  - templates/project/_head.html.haml
@@ -64,6 +65,7 @@ files:
64
65
  - templates/project/files/apple-touch-icon.png
65
66
  - templates/project/files/crossdomain.xml
66
67
  - templates/project/files/favicon.ico
68
+ - templates/project/files/google.yml
67
69
  - templates/project/files/nginx.conf
68
70
  - templates/project/files/robots.txt
69
71
  - templates/project/files/web.config
@@ -79,7 +81,7 @@ files:
79
81
  - templates/project/javascripts/profiling/yahoo-profiling.min.js
80
82
  - templates/project/javascripts/rails.js
81
83
  - templates/project/manifest.rb
82
- - templates/project/partials/_defaults.scss
84
+ - templates/project/partials/_base.scss
83
85
  - templates/project/partials/_example.scss
84
86
  - templates/project/partials/_page.scss
85
87
  - templates/project/style.scss
@@ -1,23 +0,0 @@
1
- // This file must be imported before loading html5-boilerplate
2
-
3
- $base-font-family: unquote('sans-serif');
4
-
5
- $base-font-size: 13px;
6
-
7
- $base-line-height: 1.231;
8
-
9
- $font-color: #444;
10
-
11
- $link-color: #607890;
12
-
13
- $link-hover-color: #036;
14
-
15
- $link-active-color: #607890;
16
-
17
- $link-visited-color: #607890;
18
-
19
- $selected-font-color: #fff;
20
-
21
- $selected-background-color: #FF5E99;
22
-
23
- $list-left-margin: 1.8em;