html5-boilerplate 1.0.0 → 2.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 +30 -94
- data/VERSION +1 -1
- data/lib/app/helpers/html5_boilerplate_helper.rb +1 -0
- data/lib/html5-boilerplate.rb +1 -1
- data/templates/project/_head.html.haml +8 -5
- data/templates/project/_javascripts.html.haml +16 -6
- data/templates/project/_stylesheets.html.haml +1 -1
- data/templates/project/application.html.haml +1 -1
- data/templates/project/files/apple-touch-icon-114x114-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-57x57-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-72x72-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon.png +0 -0
- data/templates/project/files/htaccess +135 -110
- data/templates/project/index.html.haml +37 -20
- data/templates/project/javascripts/{jquery-1.6.js → jquery-1.6.2.js} +369 -253
- data/templates/project/javascripts/jquery-1.6.2.min.js +18 -0
- data/templates/project/javascripts/modernizr-2.0.6.min.js +4 -0
- data/templates/project/javascripts/plugins.js +7 -3
- data/templates/project/javascripts/rails.js +90 -37
- data/templates/project/manifest.rb +10 -7
- data/templates/project/partials/_base.scss +9 -18
- data/templates/project/partials/_media.scss +20 -14
- data/templates/project/partials/_overrides.scss +47 -57
- data/templates/project/partials/_page.scss +0 -32
- data/templates/project/style.scss +6 -10
- metadata +50 -61
- data/stylesheets/_html5-boilerplate.scss +0 -20
- data/stylesheets/html5-boilerplate/_fonts.scss +0 -42
- data/stylesheets/html5-boilerplate/_helpers.scss +0 -71
- data/stylesheets/html5-boilerplate/_media.scss +0 -35
- data/stylesheets/html5-boilerplate/_reset.scss +0 -43
- data/stylesheets/html5-boilerplate/_styles.scss +0 -126
- data/templates/project/handheld.scss +0 -8
- data/templates/project/javascripts/jquery-1.6.min.js +0 -16
- data/templates/project/javascripts/modernizr-1.7.min.js +0 -2
- data/templates/project/javascripts/respond.min.js +0 -7
data/README.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
NOTICE!!! (And Now for Something Completely Different)
|
2
|
+
=========================================================
|
3
|
+
|
4
|
+
If you are using Rails, you should now be using [html5-rails](https://github.com/sporkd/html5-rails) instead of this gem.
|
5
|
+
It has all you need to get Html5Boilerplate up and running with the Rails 3 asset pipeline, plus a bunch of other nice new conventions.
|
6
|
+
|
7
|
+
For the rest of you who still want to use this gem for standalone projects or for older verisons of Rails, here's what you need to know:
|
8
|
+
|
9
|
+
* The compass CSS library has been moved out of this gem and into the [compass-h5bp](https://github.com/sporkd/compass-h5bp) gem. This allows both gems to benifit from updates to the compass library.
|
10
|
+
* The newest version of [compass-h5bp](https://github.com/sporkd/compass-h5bp) uses normalize.css instead of reset, just like current Html5Boilerplate. So upgrading might be a pain.
|
11
|
+
|
12
|
+
So in short, I have shifted my efforts to [html5-rails](https://github.com/sporkd/html5-rails), and I now view this gem
|
13
|
+
as the first standalone implementation of [compass-h5bp](https://github.com/sporkd/compass-h5bp).
|
14
|
+
To this end I will continue to merge pull requests for those who want to continue using it.
|
15
|
+
|
16
|
+
Of course, I encourage anyone to create other implementations of [compass-h5bp](https://github.com/sporkd/compass-h5bp) for [insert your framework here].
|
17
|
+
|
18
|
+
|
19
|
+
About
|
20
|
+
==========
|
3
21
|
|
4
22
|
HTML5 Boilerplate is a Compass extension based on HTML5 Boilerplate by Paul Irish.
|
5
23
|
You can use it to kick-start fully compliant HTML5 applications. Setup your Rails
|
@@ -16,104 +34,17 @@ Features
|
|
16
34
|
* Lets you pick and choose only the Boilerplate mixins and includes you want
|
17
35
|
* Generates sass/scss partials to keep your stylesheets organized
|
18
36
|
* 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
37
|
* Fully commented source, but the haml/sass output remains comment free
|
27
38
|
* Not tested on animals
|
28
39
|
|
29
|
-
Rails Installation
|
30
|
-
==================
|
31
|
-
|
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
|
41
|
-
compass init rails -r html5-boilerplate -u html5-boilerplate --force
|
42
|
-
|
43
|
-
(Using `--force` flag will overwrite any files that may already exist. In most cases this is probably what you want.)
|
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 app/views/layouts/application.html.erb app/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
|
-
|
56
|
-
app/views/layouts/application.html.haml
|
57
|
-
app/views/layouts/_flashes.html.haml
|
58
|
-
app/views/layouts/_footer.html.haml
|
59
|
-
app/views/layouts/_head.html.haml
|
60
|
-
app/views/layouts/_header.html.haml
|
61
|
-
app/views/layouts/_javascripts.html.haml
|
62
|
-
app/views/layouts/_stylesheets.html.haml
|
63
|
-
|
64
|
-
app/stylesheets/style.scss
|
65
|
-
app/stylesheets/partials/_base.scss
|
66
|
-
app/stylesheets/partials/_overrides.scss
|
67
|
-
app/stylesheets/partials/_page.scss
|
68
|
-
app/stylesheets/partials/_fonts.scss
|
69
|
-
app/stylesheets/partials/_media.scss
|
70
|
-
|
71
|
-
public/404.html
|
72
|
-
public/.htaccess
|
73
|
-
public/crossdomain.xml
|
74
|
-
public/robots.txt
|
75
|
-
public/humans.txt
|
76
|
-
public/apple-touch-icon.png
|
77
|
-
public/favicon.ico
|
78
|
-
|
79
|
-
public/javascripts/jquery.min.js
|
80
|
-
public/javascripts/modernizr.min.js
|
81
|
-
public/javascripts/plugins.js
|
82
|
-
public/javascripts/rails.js
|
83
|
-
|
84
|
-
config/compass.rb
|
85
|
-
config/initializers/compass.rb
|
86
|
-
config/google.yml
|
87
|
-
|
88
|
-
The Scss files above will automatically get compiled to your Sass compilation directory:
|
89
|
-
|
90
|
-
public/stylesheets/style.css
|
91
|
-
|
92
|
-
**Note:** If you already have a config/compass.rb file in your project, you may need to
|
93
|
-
manually add the following line to the top:
|
94
|
-
|
95
|
-
require 'html5-boilerplate'
|
96
|
-
|
97
|
-
### A few more points...
|
98
|
-
|
99
|
-
The haml will compile to the equivalent of html5-boilerplate's index.html,
|
100
|
-
but with all comments stripped out, and some additional rails stuff
|
101
|
-
like csrf_meta_tags, flashes and the Rails jquery-ujs driver.
|
102
|
-
|
103
|
-
You can set your own Google Analytics Account ID and your Google API Key
|
104
|
-
either as ENV variables, or inside config/google.yml. (see that file)
|
105
|
-
|
106
|
-
This extension has only been tested on Rails3.
|
107
|
-
|
108
40
|
|
109
|
-
|
41
|
+
Installation
|
110
42
|
========================
|
111
43
|
|
112
|
-
|
113
|
-
It will create a simplified index.html (with haml source), but without the nice Rails helpers.
|
44
|
+
(This is for stand-alone. Rails install instructions live on only in the git history)
|
114
45
|
|
115
46
|
gem install html5-boilerplate
|
116
|
-
compass create my_project -r html5-boilerplate -u html5-boilerplate --javascripts-dir js --css-dir css
|
47
|
+
compass create my_project -r compass-h5bp -r html5-boilerplate -u html5-boilerplate --javascripts-dir js --css-dir css
|
117
48
|
|
118
49
|
The `--javascripts-dir` and `--css-dir` flags are to keep consistent with the original project layout.
|
119
50
|
If you omit them, be sure to edit your javascript and style tags accordingly in index.html.
|
@@ -127,6 +58,10 @@ If you omit them, be sure to edit your javascript and style tags accordingly in
|
|
127
58
|
robots.txt
|
128
59
|
humans.txt
|
129
60
|
apple-touch-icon.png
|
61
|
+
apple-touch-icon-57x57-precomposed.png
|
62
|
+
apple-touch-icon-72x72-precomposed.png
|
63
|
+
apple-touch-icon-114x114-precomposed.png
|
64
|
+
apple-touch-icon-precomposed.png
|
130
65
|
favicon.ico
|
131
66
|
|
132
67
|
src/style.scss
|
@@ -136,9 +71,10 @@ If you omit them, be sure to edit your javascript and style tags accordingly in
|
|
136
71
|
src/partials/_fonts.scss
|
137
72
|
src/partials/_media.scss
|
138
73
|
|
139
|
-
js/jquery.min.js
|
140
|
-
js/modernizr.min.js
|
74
|
+
js/jquery-1.6.2.min.js
|
75
|
+
js/modernizr-2.0.6.min.js
|
141
76
|
js/plugins.js
|
77
|
+
js/script.js
|
142
78
|
|
143
79
|
.htaccess
|
144
80
|
config.rb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
2.1.0
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Html5BoilerplateHelper
|
2
2
|
# Create a named haml tag to wrap IE conditional around a block
|
3
3
|
# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
|
4
|
+
# Consider adding an manifest.appcache: h5bp.com/d/Offline
|
4
5
|
def ie_tag(name=:body, attrs={}, &block)
|
5
6
|
attrs.symbolize_keys!
|
6
7
|
haml_concat("<!--[if lt IE 7]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->".html_safe)
|
data/lib/html5-boilerplate.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Compass::Frameworks.register("html5-boilerplate", :path => "#{File.dirname(__FILE__)}/..")
|
1
|
+
Compass::Frameworks.register("html5-boilerplate", :path => "#{File.dirname(__FILE__)}/..") if defined?(Compass)
|
2
2
|
|
3
3
|
if defined?(ActionController)
|
4
4
|
require File.join(File.dirname(__FILE__), 'app', 'helpers', 'html5_boilerplate_helper')
|
@@ -1,7 +1,8 @@
|
|
1
1
|
%meta{ :charset => "utf-8" }/
|
2
2
|
|
3
|
-
-#
|
4
|
-
|
3
|
+
-#
|
4
|
+
Use the .htaccess and remove these lines to avoid edge case issues.
|
5
|
+
More info: h5bp.com/b/378
|
5
6
|
%meta{ "http-equiv" => "X-UA-Compatible", :content => "IE=edge,chrome=1" }/
|
6
7
|
|
7
8
|
%title
|
@@ -19,8 +20,10 @@
|
|
19
20
|
- if local_assigns[:stylesheet_partial]
|
20
21
|
= render :partial => local_assigns[:stylesheet_partial]
|
21
22
|
|
22
|
-
-#
|
23
|
-
|
24
|
-
|
23
|
+
-#
|
24
|
+
All JavaScript at the bottom, except for Modernizr / Respond.
|
25
|
+
Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
|
26
|
+
For optimal performance, use a custom Modernizr build: www.modernizr.com/download/
|
27
|
+
= javascript_include_tag 'modernizr.min'
|
25
28
|
|
26
29
|
= csrf_meta_tag
|
@@ -3,13 +3,13 @@
|
|
3
3
|
-# remote_jquery and local_jquery helpers use minified jquery unless Rails.env is development
|
4
4
|
- if !google_api_key.blank?
|
5
5
|
= javascript_include_tag "//www.google.com/jsapi?key=#{google_api_key}"
|
6
|
-
|
7
|
-
google.load(#{ remote_jquery("1.6") });
|
6
|
+
%script
|
7
|
+
google.load(#{ remote_jquery("1.6.2") });
|
8
8
|
- else
|
9
|
-
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/#{ local_jquery("1.6") }"
|
9
|
+
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/#{ local_jquery("1.6.2") }"
|
10
10
|
|
11
11
|
-# fall back to local jQuery if necessary
|
12
|
-
|
12
|
+
%script
|
13
13
|
window.jQuery || document.write("<script src='/javascripts/jquery.min.js'>\x3C/script>")
|
14
14
|
|
15
15
|
= javascript_include_tag 'rails', 'plugins', 'application'
|
@@ -20,8 +20,18 @@
|
|
20
20
|
-# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
|
21
21
|
-# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/google.yml
|
22
22
|
- if !google_account_id.blank?
|
23
|
-
|
23
|
+
%script
|
24
24
|
var _gaq=[["_setAccount","#{google_account_id}"],["_trackPageview"],["_trackPageLoadTime"]];
|
25
25
|
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
|
26
26
|
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
|
27
|
-
s.parentNode.insertBefore(g,s)}(document,"script"));
|
27
|
+
s.parentNode.insertBefore(g,s)}(document,"script"));
|
28
|
+
|
29
|
+
-#
|
30
|
+
Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
|
31
|
+
chromium.org/developers/how-tos/chrome-frame-getting-started
|
32
|
+
|
33
|
+
<!--[if lt IE 7]>
|
34
|
+
%script{ :src => "//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js" }
|
35
|
+
%script
|
36
|
+
window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})
|
37
|
+
<![endif]-->
|
@@ -1,6 +1,6 @@
|
|
1
1
|
!!! 5
|
2
2
|
-# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
|
3
|
-
-ie_html :class => 'no-js', :lang => 'en' do
|
3
|
+
-ie_html :class => 'no-js oldie', :lang => 'en' do
|
4
4
|
%head
|
5
5
|
-# To render a different stylesheet partial inside the head (i.e. for admin layout)
|
6
6
|
-# just copy _stylesheets.html.haml, and point to that partial instead.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -25,18 +25,12 @@
|
|
25
25
|
# github.com/rails/rails/commit/123eb25#commitcomment-118920
|
26
26
|
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
|
27
27
|
|
28
|
-
<IfModule mod_setenvif.c>
|
29
|
-
<IfModule mod_headers.c>
|
30
|
-
BrowserMatch MSIE ie
|
31
|
-
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
|
32
|
-
</IfModule>
|
33
|
-
</IfModule>
|
34
|
-
|
35
28
|
<IfModule mod_headers.c>
|
36
|
-
|
37
|
-
#
|
38
|
-
|
39
|
-
|
29
|
+
Header set X-UA-Compatible "IE=Edge,chrome=1"
|
30
|
+
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
|
31
|
+
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$" >
|
32
|
+
Header unset X-UA-Compatible
|
33
|
+
</FilesMatch>
|
40
34
|
</IfModule>
|
41
35
|
|
42
36
|
|
@@ -58,11 +52,11 @@
|
|
58
52
|
# Webfont access
|
59
53
|
# ----------------------------------------------------------------------
|
60
54
|
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
55
|
+
# Allow access from all domains for webfonts.
|
56
|
+
# Alternatively you could only whitelist your
|
57
|
+
# subdomains like "subdomain.example.com".
|
64
58
|
|
65
|
-
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
|
59
|
+
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
|
66
60
|
<IfModule mod_headers.c>
|
67
61
|
Header set Access-Control-Allow-Origin "*"
|
68
62
|
</IfModule>
|
@@ -74,26 +68,34 @@
|
|
74
68
|
# Proper MIME type for all files
|
75
69
|
# ----------------------------------------------------------------------
|
76
70
|
|
77
|
-
|
71
|
+
|
72
|
+
# JavaScript
|
73
|
+
# Normalize to standard type (it's sniffed in IE anyways)
|
74
|
+
# tools.ietf.org/html/rfc4329#section-7.2
|
75
|
+
AddType application/javascript js
|
76
|
+
|
77
|
+
# Audio
|
78
78
|
AddType audio/ogg oga ogg
|
79
|
+
AddType audio/mp4 m4a
|
79
80
|
|
80
|
-
#
|
81
|
+
# Video
|
81
82
|
AddType video/ogg ogv
|
82
|
-
AddType video/mp4 mp4
|
83
|
+
AddType video/mp4 mp4 m4v
|
83
84
|
AddType video/webm webm
|
84
85
|
|
85
|
-
#
|
86
|
+
# SVG.
|
87
|
+
# Required for svg webfonts on iPad
|
86
88
|
# twitter.com/FontSquirrel/status/14855840545
|
87
89
|
AddType image/svg+xml svg svgz
|
88
90
|
AddEncoding gzip svgz
|
89
91
|
|
90
|
-
#
|
92
|
+
# Webfonts
|
91
93
|
AddType application/vnd.ms-fontobject eot
|
92
|
-
AddType font
|
94
|
+
AddType application/x-font-ttf ttf ttc
|
93
95
|
AddType font/opentype otf
|
94
96
|
AddType application/x-font-woff woff
|
95
97
|
|
96
|
-
#
|
98
|
+
# Assorted types
|
97
99
|
AddType image/x-icon ico
|
98
100
|
AddType image/webp webp
|
99
101
|
AddType text/cache-manifest appcache manifest
|
@@ -101,6 +103,7 @@ AddType text/x-component htc
|
|
101
103
|
AddType application/x-chrome-extension crx
|
102
104
|
AddType application/x-xpinstall xpi
|
103
105
|
AddType application/octet-stream safariextz
|
106
|
+
AddType text/x-vcard vcf
|
104
107
|
|
105
108
|
|
106
109
|
|
@@ -111,54 +114,69 @@ AddType application/octet-stream safariextz
|
|
111
114
|
# e.g. Inside of script.combined.js you could have
|
112
115
|
# <!--#include file="libs/jquery-1.5.0.min.js" -->
|
113
116
|
# <!--#include file="plugins/jquery.idletimer.js" -->
|
114
|
-
# and they would be included into this single file
|
117
|
+
# and they would be included into this single file.
|
115
118
|
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
+
# This is not in use in the boilerplate as it stands. You may
|
120
|
+
# choose to name your files in this way for this advantage or
|
121
|
+
# concatenate and minify them manually.
|
119
122
|
# Disabled by default.
|
120
123
|
|
121
|
-
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
|
124
|
+
#<FilesMatch "\.combined\.js$">
|
125
|
+
# Options +Includes
|
126
|
+
# AddOutputFilterByType INCLUDES application/javascript application/json
|
127
|
+
# SetOutputFilter INCLUDES
|
128
|
+
#</FilesMatch>
|
129
|
+
#<FilesMatch "\.combined\.css$">
|
130
|
+
# Options +Includes
|
131
|
+
# AddOutputFilterByType INCLUDES text/css
|
132
|
+
# SetOutputFilter INCLUDES
|
133
|
+
#</FilesMatch>
|
126
134
|
|
127
135
|
|
128
136
|
# ----------------------------------------------------------------------
|
129
|
-
#
|
137
|
+
# Gzip compression
|
130
138
|
# ----------------------------------------------------------------------
|
131
139
|
|
132
140
|
<IfModule mod_deflate.c>
|
133
141
|
|
134
|
-
|
135
|
-
# force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
|
142
|
+
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
|
136
143
|
<IfModule mod_setenvif.c>
|
137
144
|
<IfModule mod_headers.c>
|
138
|
-
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s
|
145
|
+
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
|
139
146
|
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
140
147
|
</IfModule>
|
141
148
|
</IfModule>
|
142
|
-
|
149
|
+
|
150
|
+
# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
|
143
151
|
<IfModule filter_module>
|
144
152
|
FilterDeclare COMPRESS
|
145
|
-
FilterProvider COMPRESS DEFLATE resp=Content-Type
|
146
|
-
FilterProvider COMPRESS DEFLATE resp=Content-Type /
|
153
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
|
154
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
|
155
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
|
156
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
|
157
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
|
158
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
|
159
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
|
160
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
|
161
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
|
162
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
|
163
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
|
164
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
|
165
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
|
166
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
|
167
|
+
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
|
147
168
|
FilterChain COMPRESS
|
148
|
-
FilterProtocol COMPRESS change=yes;byteranges=no
|
169
|
+
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
|
149
170
|
</IfModule>
|
150
171
|
|
151
172
|
<IfModule !mod_filter.c>
|
152
173
|
# Legacy versions of Apache
|
153
174
|
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
|
154
|
-
AddOutputFilterByType DEFLATE
|
175
|
+
AddOutputFilterByType DEFLATE application/javascript
|
155
176
|
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
|
177
|
+
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
|
178
|
+
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
|
156
179
|
</IfModule>
|
157
|
-
|
158
|
-
# webfonts and svg:
|
159
|
-
<FilesMatch "\.(ttf|otf|eot|svg)$" >
|
160
|
-
SetOutputFilter DEFLATE
|
161
|
-
</FilesMatch>
|
162
180
|
</IfModule>
|
163
181
|
|
164
182
|
|
@@ -167,14 +185,14 @@ AddType application/octet-stream safariextz
|
|
167
185
|
# Expires headers (for better cache control)
|
168
186
|
# ----------------------------------------------------------------------
|
169
187
|
|
170
|
-
#
|
171
|
-
#
|
188
|
+
# These are pretty far-future expires headers.
|
189
|
+
# They assume you control versioning with cachebusting query params like
|
172
190
|
# <script src="application.js?20100608">
|
173
|
-
#
|
191
|
+
# Additionally, consider that outdated proxies may miscache
|
174
192
|
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
|
175
193
|
|
176
|
-
#
|
177
|
-
# "access plus 1 week" or so
|
194
|
+
# If you don't use filenames to version, lower the CSS and JS to something like
|
195
|
+
# "access plus 1 week" or so.
|
178
196
|
|
179
197
|
<IfModule mod_expires.c>
|
180
198
|
ExpiresActive on
|
@@ -182,24 +200,25 @@ AddType application/octet-stream safariextz
|
|
182
200
|
# Perhaps better to whitelist expires rules? Perhaps.
|
183
201
|
ExpiresDefault "access plus 1 month"
|
184
202
|
|
185
|
-
# cache.appcache needs re-requests in FF 3.6 (
|
203
|
+
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
|
186
204
|
ExpiresByType text/cache-manifest "access plus 0 seconds"
|
187
205
|
|
188
|
-
#
|
206
|
+
# Your document html
|
189
207
|
ExpiresByType text/html "access plus 0 seconds"
|
190
208
|
|
191
|
-
#
|
209
|
+
# Data
|
192
210
|
ExpiresByType text/xml "access plus 0 seconds"
|
193
211
|
ExpiresByType application/xml "access plus 0 seconds"
|
194
212
|
ExpiresByType application/json "access plus 0 seconds"
|
195
213
|
|
196
|
-
#
|
214
|
+
# Feed
|
197
215
|
ExpiresByType application/rss+xml "access plus 1 hour"
|
216
|
+
ExpiresByType application/atom+xml "access plus 1 hour"
|
198
217
|
|
199
|
-
#
|
218
|
+
# Favicon (cannot be renamed)
|
200
219
|
ExpiresByType image/x-icon "access plus 1 week"
|
201
220
|
|
202
|
-
#
|
221
|
+
# Media: images, video, audio
|
203
222
|
ExpiresByType image/gif "access plus 1 month"
|
204
223
|
ExpiresByType image/png "access plus 1 month"
|
205
224
|
ExpiresByType image/jpg "access plus 1 month"
|
@@ -209,20 +228,19 @@ AddType application/octet-stream safariextz
|
|
209
228
|
ExpiresByType video/mp4 "access plus 1 month"
|
210
229
|
ExpiresByType video/webm "access plus 1 month"
|
211
230
|
|
212
|
-
#
|
231
|
+
# HTC files (css3pie)
|
213
232
|
ExpiresByType text/x-component "access plus 1 month"
|
214
233
|
|
215
|
-
#
|
234
|
+
# Webfonts
|
216
235
|
ExpiresByType font/truetype "access plus 1 month"
|
217
236
|
ExpiresByType font/opentype "access plus 1 month"
|
218
237
|
ExpiresByType application/x-font-woff "access plus 1 month"
|
219
238
|
ExpiresByType image/svg+xml "access plus 1 month"
|
220
239
|
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
221
240
|
|
222
|
-
#
|
223
|
-
ExpiresByType text/css "access plus
|
224
|
-
ExpiresByType application/javascript "access plus
|
225
|
-
ExpiresByType text/javascript "access plus 2 months"
|
241
|
+
# CSS and JavaScript
|
242
|
+
ExpiresByType text/css "access plus 1 year"
|
243
|
+
ExpiresByType application/javascript "access plus 1 year"
|
226
244
|
|
227
245
|
<IfModule mod_headers.c>
|
228
246
|
Header append Cache-Control "public"
|
@@ -236,6 +254,11 @@ AddType application/octet-stream safariextz
|
|
236
254
|
# ETag removal
|
237
255
|
# ----------------------------------------------------------------------
|
238
256
|
|
257
|
+
# FileETag None is not enough for every server.
|
258
|
+
<IfModule mod_headers.c>
|
259
|
+
Header unset ETag
|
260
|
+
</IfModule>
|
261
|
+
|
239
262
|
# Since we're sending far-future expires, we don't need ETags for
|
240
263
|
# static content.
|
241
264
|
# developer.yahoo.com/performance/rules.html#etags
|
@@ -278,8 +301,10 @@ FileETag None
|
|
278
301
|
# ----------------------------------------------------------------------
|
279
302
|
|
280
303
|
# Turning on the rewrite engine is necessary for the following rules and features.
|
304
|
+
# FollowSymLinks must be enabled for this to work.
|
281
305
|
|
282
306
|
<IfModule mod_rewrite.c>
|
307
|
+
Options +FollowSymlinks
|
283
308
|
RewriteEngine On
|
284
309
|
</IfModule>
|
285
310
|
|
@@ -303,65 +328,29 @@ FileETag None
|
|
303
328
|
# ----------------------------------------------------------------------
|
304
329
|
|
305
330
|
# Option 1:
|
306
|
-
# Rewrite "www.
|
331
|
+
# Rewrite "www.example.com -> example.com"
|
307
332
|
|
308
333
|
<IfModule mod_rewrite.c>
|
309
334
|
RewriteCond %{HTTPS} !=on
|
310
335
|
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
311
|
-
RewriteRule ^
|
336
|
+
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
|
312
337
|
</IfModule>
|
313
338
|
|
314
339
|
# ----------------------------------------------------------------------
|
315
340
|
|
316
341
|
# Option 2:
|
317
|
-
# To rewrite "
|
342
|
+
# To rewrite "example.com -> www.example.com" uncomment the following lines.
|
318
343
|
# Be aware that the following rule might not be a good idea if you
|
319
344
|
# use "real" subdomains for certain parts of your website.
|
320
345
|
|
321
346
|
# <IfModule mod_rewrite.c>
|
322
347
|
# RewriteCond %{HTTPS} !=on
|
323
348
|
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
|
324
|
-
#
|
325
|
-
# RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
|
349
|
+
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
326
350
|
# </IfModule>
|
327
351
|
|
328
352
|
|
329
353
|
|
330
|
-
# ----------------------------------------------------------------------
|
331
|
-
# Add/remove trailing slash to (non-file) URLs
|
332
|
-
# ----------------------------------------------------------------------
|
333
|
-
|
334
|
-
# Google treats URLs with and without trailing slashes separately.
|
335
|
-
# Forcing a trailing slash is usually preferred, but all that's really
|
336
|
-
# important is that one correctly redirects to the other.
|
337
|
-
|
338
|
-
# By default option 1 (force trailing slash) is activated.
|
339
|
-
# http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html
|
340
|
-
# http://www.alistapart.com/articles/slashforward/
|
341
|
-
# http://httpd.apache.org/docs/2.0/misc/rewriteguide.html#url Trailing Slash Problem
|
342
|
-
|
343
|
-
# ----------------------------------------------------------------------
|
344
|
-
|
345
|
-
# Option 1:
|
346
|
-
# Rewrite "domain.com/foo -> domain.com/foo/"
|
347
|
-
|
348
|
-
<IfModule mod_rewrite.c>
|
349
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
350
|
-
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
|
351
|
-
RewriteRule ^(.*)$ /$1/ [R=301,L]
|
352
|
-
</IfModule>
|
353
|
-
|
354
|
-
# ----------------------------------------------------------------------
|
355
|
-
|
356
|
-
# Option 2:
|
357
|
-
# Rewrite "domain.com/foo/ -> domain.com/foo"
|
358
|
-
|
359
|
-
#<IfModule mod_rewrite.c>
|
360
|
-
# RewriteRule ^(.*)/$ /$1 [R=301,L]
|
361
|
-
#</IfModule>
|
362
|
-
|
363
|
-
|
364
|
-
|
365
354
|
# ----------------------------------------------------------------------
|
366
355
|
# Built-in filename-based cache busting
|
367
356
|
# ----------------------------------------------------------------------
|
@@ -387,12 +376,12 @@ FileETag None
|
|
387
376
|
# ----------------------------------------------------------------------
|
388
377
|
|
389
378
|
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
|
390
|
-
# https://www.
|
379
|
+
# https://www.example.com when your cert only allows https://secure.example.com
|
391
380
|
# Uncomment the following lines to use this feature.
|
392
381
|
|
393
382
|
# <IfModule mod_rewrite.c>
|
394
383
|
# RewriteCond %{SERVER_PORT} !^443
|
395
|
-
# RewriteRule
|
384
|
+
# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
|
396
385
|
# </IfModule>
|
397
386
|
|
398
387
|
|
@@ -409,7 +398,7 @@ Options -MultiViews
|
|
409
398
|
|
410
399
|
|
411
400
|
# ----------------------------------------------------------------------
|
412
|
-
#
|
401
|
+
# Custom 404 page
|
413
402
|
# ----------------------------------------------------------------------
|
414
403
|
|
415
404
|
# You can add custom pages to handle 500 or 403 pretty easily, if you like.
|
@@ -421,11 +410,11 @@ ErrorDocument 404 /404.html
|
|
421
410
|
# UTF-8 encoding
|
422
411
|
# ----------------------------------------------------------------------
|
423
412
|
|
424
|
-
#
|
413
|
+
# Use UTF-8 encoding for anything served text/plain or text/html
|
425
414
|
AddDefaultCharset utf-8
|
426
415
|
|
427
|
-
#
|
428
|
-
AddCharset utf-8 .html .css .js .xml .json .rss
|
416
|
+
# Force UTF-8 for a number of file formats
|
417
|
+
AddCharset utf-8 .html .css .js .xml .json .rss .atom
|
429
418
|
|
430
419
|
|
431
420
|
|
@@ -470,9 +459,45 @@ Options -Indexes
|
|
470
459
|
|
471
460
|
# php_flag register_globals Off
|
472
461
|
|
462
|
+
# Rename session cookie to something else, than PHPSESSID
|
463
|
+
# php_value session.name sid
|
464
|
+
|
465
|
+
# Do not show you are using PHP
|
466
|
+
# Note: Move this line to php.ini since it won't work in .htaccess
|
467
|
+
# php_flag expose_php Off
|
468
|
+
|
469
|
+
# Level of log detail - log all errors
|
470
|
+
# php_value error_reporting -1
|
471
|
+
|
472
|
+
# Write errors to log file
|
473
|
+
# php_flag log_errors On
|
474
|
+
|
475
|
+
# Do not display errors in browser (production - Off, development - On)
|
476
|
+
# php_flag display_errors Off
|
477
|
+
|
478
|
+
# Do not display startup errors (production - Off, development - On)
|
479
|
+
# php_flag display_startup_errors Off
|
480
|
+
|
481
|
+
# Format errors in plain text
|
482
|
+
# Note: Leave this setting 'On' for xdebug's var_dump() output
|
483
|
+
# php_flag html_errors Off
|
484
|
+
|
485
|
+
# Show multiple occurrence of error
|
486
|
+
# php_flag ignore_repeated_errors Off
|
487
|
+
|
488
|
+
# Show same errors from different sources
|
489
|
+
# php_flag ignore_repeated_source Off
|
490
|
+
|
491
|
+
# Size limit for error messages
|
492
|
+
# php_value log_errors_max_len 1024
|
493
|
+
|
494
|
+
# Don't precede error with string (doesn't accept empty string, use whitespace if you need)
|
495
|
+
# php_value error_prepend_string " "
|
496
|
+
|
497
|
+
# Don't prepend to error (doesn't accept empty string, use whitespace if you need)
|
498
|
+
# php_value error_append_string " "
|
473
499
|
|
474
500
|
# Increase cookie security
|
475
501
|
<IfModule php5_module>
|
476
|
-
php_value session.cookie_httponly true
|
502
|
+
php_value session.cookie_httponly true
|
477
503
|
</IfModule>
|
478
|
-
|