Skip to content
Permalink
Browse files

Switch to brotli instead of zopfli

  • Loading branch information...
zachleat committed Jun 11, 2019
1 parent dd26a17 commit 4e8f33e3ca55b16df5268721098224f1021b1bb3
Showing with 19 additions and 34 deletions.
  1. +1 −0 .eleventy.js
  2. +7 −4 .htaccess
  3. +11 −8 Gruntfile.js
  4. +0 −5 README.md
  5. +0 −1 package.json
  6. +0 −16 web/.htaccess
@@ -24,6 +24,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginSyntaxHighlight);

/* COPY */
eleventyConfig.addPassthroughCopy(".htaccess");
eleventyConfig.addPassthroughCopy("demos/");
eleventyConfig.addPassthroughCopy("img/");
eleventyConfig.addPassthroughCopy("presentations/");
@@ -3,10 +3,13 @@ RewriteEngine On
RewriteBase /
RewriteRule résumé/$ /resume/ [L]

RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{REQUEST_FILENAME}.zbr -f
RewriteRule ^(.*)$ $1.zbr [L]

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge

# RewriteRule ^$ /web/ [L]
RedirectMatch 301 /Projects$ /projects/
RedirectMatch 301 /Projects/(.*)$ /projects/$1
RedirectMatch 301 /projects/alarmd$ /alarmd/
@@ -22,8 +25,8 @@ RedirectMatch 301 /web/\d{4}/\d{2}/\d{2}/(.*)$ /web/$1
RedirectMatch 301 /web/\d{4}/(.*)$ /web/$1
</IfModule>

# mod_deflate isn't included on the production host, so we have a workaround
# in /web/.htaccess
# mod_deflate isn't included on the production host, so we have a workaround above
AddEncoding br .zbr

#<IfModule mod_deflate.c>
#AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
@@ -155,4 +158,4 @@ FileETag None
# 404 not found page
# ----------------------------------------------------------------------

ErrorDocument 404 /web/404/index.html
ErrorDocument 404 /web/404/index.html
@@ -132,10 +132,13 @@ module.exports = function(grunt) {
}
}
},
zopfli: {
compress: {
main: {
options: {
iteration: 15
mode: 'brotli',
brotli: {
mode: 1
}
},
files: [
{
@@ -144,31 +147,31 @@ module.exports = function(grunt) {
src: ['**/*.html'],
dest: '_site/',
extDot: 'last',
ext: '.html.zgz'
ext: '.html.zbr'
},
{
expand: true,
cwd: '_site/',
src: ['**/*.js'],
dest: '_site/',
extDot: 'last',
ext: '.js.zgz'
ext: '.js.zbr'
},
{
expand: true,
cwd: '_site/',
src: ['**/*.css'],
dest: '_site/',
extDot: 'last',
ext: '.css.zgz'
ext: '.css.zbr'
},
{
expand: true,
cwd: '_site/',
src: ['**/*.svg'],
dest: '_site/',
extDot: 'last',
ext: '.svg.zgz'
ext: '.svg.zbr'
}
]
}
@@ -207,7 +210,7 @@ module.exports = function(grunt) {
},
clean: {
drafts: [ '_site/web/drafts/**' ],
zopfli: [ '_site/**/*.zgz' ]
compressed: [ '_site/**/*.zbr' ]
},
watch: {
assets: {
@@ -241,6 +244,6 @@ module.exports = function(grunt) {
grunt.registerTask('separate', ['clean', 'assets', 'copy:includes']);

// Upload to Production
grunt.registerTask('stage', ['clean', 'assets', 'images', 'content', 'clean:drafts', 'htmlmin', 'zopfli']);
grunt.registerTask('stage', ['clean', 'assets', 'images', 'content', 'clean:drafts', 'htmlmin', 'compress']);
grunt.registerTask('deploy', ['stage', 'shell:upload', 'clean']);
};
@@ -28,11 +28,6 @@ To install new local npm packages, use `npm install PACKAGE_NAME --save-dev`
1. `grunt deploy`
The `deploy` task requires `zopfli`, which can be installed using:
1. `brew install zopfli`
## Notes
* [“zachleat.com is Dead, Long Live zachleat.com,” a blog post describing the initial launch](http://www.zachleat.com/web/zachleat-is-dead/)
@@ -31,7 +31,6 @@
"grunt-contrib-watch": "~1.0.0",
"grunt-grunticon": "^2.3.2",
"grunt-shell": "~2.1.0",
"grunt-zopfli": "^0.3.3",
"lodash": "^4.17.11",
"luxon": "^0.4.0",
"matchdep": "~1.0.1",

This file was deleted.

0 comments on commit 4e8f33e

Please sign in to comment.
You can’t perform that action at this time.