html5-rails 0.0.7 → 0.1.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 +23 -22
- data/app/assets/javascripts/application.js +1 -1
- data/app/assets/javascripts/polyfills.js +1 -1
- data/app/views/application/_flashes.html.erb +2 -4
- data/app/views/application/_footer.html.erb +1 -1
- data/app/views/application/_head.html.erb +3 -11
- data/app/views/application/_header.html.erb +1 -1
- data/app/views/application/_javascripts.html.erb +2 -2
- data/app/views/application/_stylesheets.html.erb +1 -1
- data/app/views/layouts/application.html.erb +4 -7
- data/html5-rails.gemspec +1 -1
- data/lib/generators/html5/assets/USAGE +7 -4
- data/lib/generators/html5/assets/assets_generator.rb +26 -25
- data/lib/generators/html5/assets/templates/javascripts/application.js +1 -1
- data/lib/generators/html5/assets/templates/javascripts/polyfills.js +1 -1
- data/lib/generators/html5/assets/templates/stylesheets/{application.css.scss → application/index.css.scss} +12 -16
- data/lib/generators/html5/assets/templates/stylesheets/application/{document.css.scss → layout.css.scss} +2 -2
- data/lib/generators/html5/assets/templates/stylesheets/application/media_queries.css.scss +15 -1
- data/lib/generators/html5/assets/templates/stylesheets/{_variables.css.scss → application/variables.css.scss} +1 -1
- data/lib/generators/html5/install/USAGE +14 -0
- data/lib/generators/html5/install/install_generator.rb +1 -1
- data/lib/generators/html5/install/templates/README +2 -2
- data/lib/generators/html5/install/templates/config/compass.rb +1 -1
- data/lib/generators/html5/install/templates/config/html5_rails.yml +2 -2
- data/lib/generators/html5/layout/USAGE +3 -3
- data/lib/generators/html5/layout/layout_generator.rb +5 -5
- data/lib/generators/html5/layout/templates/application.html.erb +3 -6
- data/lib/generators/html5/layout/templates/application.html.haml +8 -10
- data/lib/generators/html5/layout/templates/application.html.slim +18 -11
- data/lib/generators/html5/partial/USAGE +13 -3
- data/lib/generators/html5/partial/partial_generator.rb +9 -9
- data/lib/generators/html5/partial/templates/_chromeframe.html.haml +1 -1
- data/lib/generators/html5/partial/templates/_chromeframe.html.slim +1 -1
- data/lib/generators/html5/partial/templates/_flashes.html.erb +2 -4
- data/lib/generators/html5/partial/templates/_flashes.html.haml +2 -3
- data/lib/generators/html5/partial/templates/_flashes.html.slim +2 -3
- data/lib/generators/html5/partial/templates/_footer.html.erb +1 -1
- data/lib/generators/html5/partial/templates/_footer.html.haml +1 -1
- data/lib/generators/html5/partial/templates/_footer.html.slim +1 -1
- data/lib/generators/html5/partial/templates/_head.html.erb +3 -11
- data/lib/generators/html5/partial/templates/_head.html.haml +6 -17
- data/lib/generators/html5/partial/templates/_head.html.slim +6 -17
- data/lib/generators/html5/partial/templates/_header.html.erb +1 -1
- data/lib/generators/html5/partial/templates/_header.html.haml +1 -1
- data/lib/generators/html5/partial/templates/_javascripts.html.erb +2 -2
- data/lib/generators/html5/partial/templates/_javascripts.html.haml +3 -3
- data/lib/generators/html5/partial/templates/_javascripts.html.slim +4 -4
- data/lib/generators/html5/partial/templates/_stylesheets.html.erb +1 -1
- data/lib/generators/html5/partial/templates/_stylesheets.html.haml +1 -1
- data/lib/html5-rails.rb +1 -1
- data/lib/html5/rails/helpers.rb +1 -7
- data/lib/html5/rails/version.rb +2 -2
- data/test/generators/assets_generator_test.rb +18 -22
- data/test/generators/install_generator_test.rb +6 -7
- data/test/generators/layout_generator_test.rb +1 -2
- data/test/generators/partial_generator_test.rb +2 -3
- data/test/html5_rails_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/vendor/assets/javascripts/h5bp.js +22 -0
- data/vendor/assets/javascripts/modernizr.min.js +3 -3
- metadata +16 -12
- data/lib/generators/html5/assets/templates/stylesheets/application/chromeframe.css.scss +0 -14
- data/vendor/assets/javascripts/h5bp/index.js +0 -1
- data/vendor/assets/javascripts/h5bp/plugins.js +0 -7
data/README.md
CHANGED
@@ -4,8 +4,6 @@ Html5 for Rails
|
|
4
4
|
Html5 for Rails projects based on [Html5 Boilerplate](http://html5boilerplate.com)
|
5
5
|
by Paul Irish, Divya Manian and many other [fine folks](https://github.com/h5bp/html5-boilerplate/contributors).
|
6
6
|
|
7
|
-
(Also, a rewrite of compass-html5-boilerplate that adds Rails asset pipeline integration).
|
8
|
-
|
9
7
|
Installation
|
10
8
|
=========================
|
11
9
|
|
@@ -16,17 +14,18 @@ group :assets do
|
|
16
14
|
gem 'sass-rails'
|
17
15
|
gem 'coffee-rails'
|
18
16
|
gem 'uglifier'
|
19
|
-
|
17
|
+
|
20
18
|
gem 'compass-h5bp'
|
21
19
|
end
|
22
20
|
|
23
|
-
# Optional - to generate haml
|
24
|
-
#gem 'haml-rails'
|
25
|
-
# Optional - to generate slim
|
26
|
-
#gem 'slim-rails'
|
27
|
-
|
28
21
|
gem 'jquery-rails'
|
29
22
|
gem 'html5-rails'
|
23
|
+
|
24
|
+
# Optional: to generate haml
|
25
|
+
# gem 'haml-rails'
|
26
|
+
|
27
|
+
# Optional: to generate slim
|
28
|
+
# gem 'slim-rails'
|
30
29
|
```
|
31
30
|
|
32
31
|
##### 2. Install your bundle
|
@@ -45,21 +44,21 @@ $ rails generate html5:install
|
|
45
44
|
|
46
45
|
create config/compass.rb
|
47
46
|
create config/html5_rails.yml
|
48
|
-
create app/views/layouts/application.html.erb
|
47
|
+
create app/views/layouts/application.html.(erb|haml|slim)
|
49
48
|
create app/views/application
|
50
|
-
create app/views/application/_footer.html.erb
|
51
|
-
create app/views/application/_head.html.erb
|
52
|
-
create app/views/application/_header.html.erb
|
53
|
-
create app/views/application/_chromeframe.html.erb
|
49
|
+
create app/views/application/_footer.html.(erb|haml|slim)
|
50
|
+
create app/views/application/_head.html.(erb|haml|slim)
|
51
|
+
create app/views/application/_header.html.(erb|haml|slim)
|
52
|
+
create app/views/application/_chromeframe.html.(erb|haml|slim)
|
53
|
+
exist app/assets/javascripts
|
54
54
|
insert app/assets/javascripts/application.js
|
55
55
|
gsub app/assets/javascripts/application.js
|
56
56
|
create app/assets/javascripts/polyfills.js
|
57
57
|
remove app/assets/stylesheets/application.css
|
58
|
-
create app/assets/stylesheets/_variables.css.scss
|
59
|
-
create app/assets/stylesheets/application.css.scss
|
60
58
|
create app/assets/stylesheets/application
|
61
|
-
create app/assets/stylesheets/application/
|
62
|
-
create app/assets/stylesheets/application/
|
59
|
+
create app/assets/stylesheets/application/index.css.scss
|
60
|
+
create app/assets/stylesheets/application/variables.css.scss
|
61
|
+
create app/assets/stylesheets/application/layout.css.scss
|
63
62
|
create app/assets/stylesheets/application/media_queries.css.scss
|
64
63
|
|
65
64
|
##### 4. And you're done!
|
@@ -78,6 +77,11 @@ $ rails generate html5:partial --help
|
|
78
77
|
$ rails generate html5:assets --help
|
79
78
|
```
|
80
79
|
|
80
|
+
Google Analytics
|
81
|
+
=========================
|
82
|
+
|
83
|
+
By default your Google Analytics code snippet will be hidden until you set your Google Account ID.
|
84
|
+
You can do this by either setting `ENV['GOOGLE_ACCOUNT_ID']` or `google_account_id` in config/html5_rails.yml.
|
81
85
|
|
82
86
|
Notes
|
83
87
|
==========
|
@@ -86,13 +90,10 @@ Notes
|
|
86
90
|
included in your assets group for development and asset precompiling to work.
|
87
91
|
|
88
92
|
[2] If you use `--template-engine=haml` (or `haml-rails` gem), the install
|
89
|
-
generator will remove your application.html.erb layout so that
|
93
|
+
generator will prompt to remove your application.html.erb layout so that
|
90
94
|
application.html.haml will be used instead.
|
91
95
|
|
92
|
-
[3]
|
93
|
-
remove config/compass.rb before you run the generators.
|
94
|
-
|
95
|
-
[4] For the time being, you will want to add the following line to
|
96
|
+
[3] For the time being, you will want to add the following line to
|
96
97
|
config/production.rb so that polyfills are precompiled on deploy:
|
97
98
|
|
98
99
|
`config.assets.precompile += %w( polyfills.js )`
|
@@ -1,9 +1,7 @@
|
|
1
1
|
<div id="flash">
|
2
2
|
<% flash.each do |key, value| %>
|
3
|
-
<div class="
|
4
|
-
<
|
5
|
-
<p><%= value %></p>
|
6
|
-
</div>
|
3
|
+
<div title="<%= key.to_s.humanize %>" class="<%= key %>">
|
4
|
+
<p><%= value %></p>
|
7
5
|
</div>
|
8
6
|
<% end %>
|
9
7
|
</div>
|
@@ -1,22 +1,14 @@
|
|
1
1
|
<head>
|
2
2
|
<meta charset="utf-8">
|
3
|
-
|
4
|
-
<%# Use the .htaccess and remove these lines to avoid edge case issues. %>
|
5
|
-
<%# More info: h5bp.com/b/378 %>
|
6
3
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
7
4
|
|
8
|
-
<title
|
9
|
-
<meta name="description" content="">
|
5
|
+
<title><%= "#{ controller.controller_name.titleize } - #{ controller.action_name.titleize }" %></title>
|
10
6
|
|
11
|
-
|
7
|
+
<meta name="description" content="">
|
12
8
|
<meta name="viewport" content="width=device-width">
|
13
9
|
|
14
10
|
<%= render "stylesheets" %>
|
15
|
-
|
16
|
-
<%# More ideas for your <head> here: h5bp.com/d/head-Tips %>
|
17
|
-
|
18
|
-
<%# All JavaScript at the bottom, except polyfills %>
|
19
11
|
<%= javascript_include_tag "polyfills" %>
|
20
12
|
|
21
13
|
<%= csrf_meta_tag %>
|
22
|
-
</head>
|
14
|
+
</head>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%# Append your own using content_for :javascripts %>
|
4
4
|
<%= yield :javascripts %>
|
5
5
|
|
6
|
-
<%#
|
6
|
+
<%# Google Analytics %>
|
7
7
|
<%# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml %>
|
8
8
|
<% if !google_account_id.blank? %>
|
9
9
|
<script>
|
@@ -14,4 +14,4 @@
|
|
14
14
|
s.parentNode.insertBefore(g,s)}(document,'script'));
|
15
15
|
//]]>
|
16
16
|
</script>
|
17
|
-
<% end %>
|
17
|
+
<% end %>
|
@@ -1,20 +1,17 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<%# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither %>
|
3
2
|
<%= html_tag :class => "no-js" %>
|
4
3
|
<%= render "head" %>
|
5
4
|
|
6
|
-
<body class="
|
5
|
+
<body class="<%= controller.controller_name %>">
|
7
6
|
<%= render "chromeframe" %>
|
8
7
|
<%= render "header" %>
|
8
|
+
<%= render "flashes" %>
|
9
9
|
|
10
|
-
|
11
|
-
<%= render "flashes" %>
|
12
|
-
<%= yield %>
|
13
|
-
</div>
|
10
|
+
<%= yield %>
|
14
11
|
|
15
12
|
<%= render "footer" %>
|
16
13
|
|
17
14
|
<%# Javascript at the bottom for fast page loading %>
|
18
15
|
<%= render "javascripts" %>
|
19
16
|
</body>
|
20
|
-
</html>
|
17
|
+
</html>
|
data/html5-rails.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = "html5-rails"
|
16
16
|
|
17
17
|
s.add_dependency "jquery-rails", ">= 2.0"
|
18
|
-
s.add_dependency "railties", "
|
18
|
+
s.add_dependency "railties", ">= 3.2"
|
19
19
|
s.add_dependency "thor", "~> 0.14"
|
20
20
|
|
21
21
|
s.add_development_dependency "compass-h5bp", "~> 0.1.0"
|
@@ -1,11 +1,14 @@
|
|
1
1
|
Description:
|
2
|
-
Generates
|
2
|
+
Generates javascript and stylesheet assets for a named resource.
|
3
3
|
|
4
4
|
Example:
|
5
5
|
rails generate html5:assets admin
|
6
6
|
|
7
7
|
This will create:
|
8
|
-
app/assets/
|
9
|
-
app/assets/
|
10
|
-
app/assets/stylesheets/admin
|
8
|
+
app/assets/javascripts/admin.js
|
9
|
+
app/assets/javascripts/polyfills.js
|
10
|
+
app/assets/stylesheets/admin
|
11
|
+
app/assets/stylesheets/admin/index.css.scss
|
12
|
+
app/assets/stylesheets/admin/variables.css.scss
|
13
|
+
app/assets/stylesheets/admin/layout.css.scss
|
11
14
|
app/assets/stylesheets/admin/media_queries.css.scss
|
@@ -9,39 +9,40 @@ module Html5
|
|
9
9
|
|
10
10
|
argument :name, :type => :string,
|
11
11
|
:required => false,
|
12
|
-
:default =>
|
12
|
+
:default => 'application'
|
13
13
|
|
14
14
|
def generate_javascripts
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
prefix = File.join('app', 'assets', 'javascripts')
|
16
|
+
manifest = File.join(prefix, File.basename(asset_path) + '.js')
|
17
|
+
|
18
|
+
empty_directory File.join(prefix, File.dirname(asset_path))
|
19
|
+
|
20
|
+
if File.exist?(manifest) && File.read(manifest) =~ /require jquery_ujs$/
|
21
|
+
inject_into_file manifest, :after => "require jquery_ujs" do
|
18
22
|
"\n//= require h5bp"
|
19
23
|
end
|
20
|
-
gsub_file
|
24
|
+
gsub_file manifest, /^\/\/= require_tree \.(\\n)?/, ''
|
21
25
|
else
|
22
|
-
template "javascripts/application.js",
|
26
|
+
template "javascripts/application.js", manifest
|
23
27
|
end
|
24
|
-
|
28
|
+
|
29
|
+
template "javascripts/polyfills.js", File.join(prefix, 'polyfills.js')
|
25
30
|
end
|
26
31
|
|
27
32
|
def generate_stylesheets
|
28
|
-
|
29
|
-
remove_file "app/assets/stylesheets/application.css"
|
30
|
-
end
|
33
|
+
prefix = File.join('app', 'assets', 'stylesheets')
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
35
|
+
if file_path == 'application'
|
36
|
+
remove_file File.join(prefix, 'application.css')
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
empty_directory File.join("app/assets/stylesheets", asset_name)
|
39
|
+
if stylesheets.any?
|
40
|
+
empty_directory File.join(prefix, asset_path)
|
40
41
|
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
template
|
43
|
+
stylesheets.each do |stylesheet|
|
44
|
+
file_name = stylesheet + ".css.scss"
|
45
|
+
template "stylesheets/application/#{ file_name }", File.join(prefix, asset_path, file_name)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
@@ -51,13 +52,13 @@ module Html5
|
|
51
52
|
|
52
53
|
protected
|
53
54
|
|
54
|
-
def
|
55
|
-
(class_path + [file_name])
|
55
|
+
def asset_path
|
56
|
+
File.join(class_path + [file_name])
|
56
57
|
end
|
57
58
|
|
58
|
-
def
|
59
|
-
%w(
|
59
|
+
def stylesheets
|
60
|
+
%w(index variables layout media_queries)
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
63
|
-
end
|
64
|
+
end
|
@@ -1,33 +1,29 @@
|
|
1
1
|
// This file was generated by html5-rails
|
2
2
|
// https://github.com/sporkd/html5-rails
|
3
3
|
// Upgrade with: $ rails generate html5:install
|
4
|
+
//
|
5
|
+
// <%= file_path %> styles
|
4
6
|
|
5
7
|
//-----------------------------------------
|
6
|
-
// Variables
|
8
|
+
// Variables
|
7
9
|
//-----------------------------------------
|
8
|
-
@import
|
10
|
+
@import 'variables';
|
9
11
|
|
10
12
|
//-----------------------------------------
|
11
|
-
//
|
13
|
+
// Vendor imports
|
12
14
|
//-----------------------------------------
|
13
|
-
// @import
|
14
|
-
@import
|
15
|
+
// @import 'compass/css3';
|
16
|
+
@import 'h5bp';
|
15
17
|
|
16
18
|
//-----------------------------------------
|
17
|
-
//
|
19
|
+
// Vendor includes
|
18
20
|
//-----------------------------------------
|
19
21
|
@include h5bp-normalize;
|
20
22
|
@include h5bp-main;
|
23
|
+
@include h5bp-helpers;
|
21
24
|
|
22
25
|
//-----------------------------------------
|
23
|
-
// Custom
|
24
|
-
//-----------------------------------------
|
25
|
-
@import "<%= file_path %>/chromeframe";
|
26
|
-
@import "<%= file_path %>/document";
|
27
|
-
@import "<%= file_path %>/media_queries"; // Media queries last
|
28
|
-
|
29
|
-
//-----------------------------------------
|
30
|
-
// Append includes
|
26
|
+
// Custom imports
|
31
27
|
//-----------------------------------------
|
32
|
-
@
|
33
|
-
@
|
28
|
+
@import 'layout';
|
29
|
+
@import 'media_queries';
|
@@ -8,4 +8,18 @@
|
|
8
8
|
|
9
9
|
@media only screen and (min-width: 35em) {
|
10
10
|
// Style adjustments for viewports that meet the condition
|
11
|
-
}
|
11
|
+
}
|
12
|
+
|
13
|
+
@media print,
|
14
|
+
(-o-min-device-pixel-ratio: 5/4),
|
15
|
+
(-webkit-min-device-pixel-ratio: 1.25),
|
16
|
+
(min-resolution: 120dpi) {
|
17
|
+
// Style adjustments for high resolution devices
|
18
|
+
}
|
19
|
+
|
20
|
+
// Print styles.
|
21
|
+
// Inlined to avoid required HTTP connection: h5bp.com/r
|
22
|
+
|
23
|
+
@media print {
|
24
|
+
@include h5bp-media-print;
|
25
|
+
}
|
@@ -7,3 +7,17 @@ Example:
|
|
7
7
|
This will create:
|
8
8
|
config/compass.rb
|
9
9
|
config/html5_rails.yml
|
10
|
+
app/views/layouts/application.html.(erb|haml|slim)
|
11
|
+
app/views/layouts/application.html.(erb|haml|slim)
|
12
|
+
app/views/application
|
13
|
+
app/views/application/_footer.html.(erb|haml|slim)
|
14
|
+
app/views/application/_head.html.(erb|haml|slim)
|
15
|
+
app/views/application/_header.html.(erb|haml|slim)
|
16
|
+
app/views/application/_chromeframe.html.(erb|haml|slim)
|
17
|
+
app/assets/javascripts/application.js
|
18
|
+
app/assets/javascripts/polyfills.js
|
19
|
+
app/assets/stylesheets/application
|
20
|
+
app/assets/stylesheets/application/index.css.scss
|
21
|
+
app/assets/stylesheets/application/variables.css.scss
|
22
|
+
app/assets/stylesheets/application/layout.css.scss
|
23
|
+
app/assets/stylesheets/application/media_queries.css.scss
|
@@ -1,6 +1,6 @@
|
|
1
1
|
===============================================================================
|
2
2
|
|
3
|
-
You
|
3
|
+
You've successfully installed html5-rails!
|
4
4
|
|
5
5
|
If want to genrate additional layouts, just run:
|
6
6
|
$ rails g html5:layout my_new_layout
|
@@ -8,4 +8,4 @@ $ rails g html5:layout my_new_layout
|
|
8
8
|
Or if want to customize your other shared partials:
|
9
9
|
$ rails g html5:partial --all
|
10
10
|
|
11
|
-
===============================================================================
|
11
|
+
===============================================================================
|