Skip to content
Permalink
Browse files

Use gzip instead of brotli for HTML requests to workaround snarfed/br…

…idgy#878 to get bridgy working again.
  • Loading branch information...
zachleat committed Jun 29, 2019
1 parent fe963d2 commit 583b0a2d9d4113807524dedd766d3c468e75b6e3
Showing with 35 additions and 11 deletions.
  1. +6 −0 .htaccess
  2. +27 −9 Gruntfile.js
  3. +1 −1 _data/webmentions.js
  4. +1 −1 package.json
@@ -3,7 +3,12 @@ RewriteEngine On
RewriteBase /
RewriteRule résumé/$ /resume/ [L]

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

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

@@ -27,6 +32,7 @@ RedirectMatch 301 /web/\d{4}/(.*)$ /web/$1

# mod_deflate isn't included on the production host, so we have a workaround above
AddEncoding br .zbr
AddEncoding gzip .zgz

#<IfModule mod_deflate.c>
#AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
@@ -52,7 +52,7 @@ module.exports = function(grunt) {
'node_modules/infinity-burger/infinity-burger.js',
'<%= config.jsSrc %>fontloademu.js',
'<%= config.jsSrc %>google-analytics.js',
'<%= config.jsSrc %>twitter-api.js',
// '<%= config.jsSrc %>twitter-api.js',
'<%= config.jsSrc %>lazyimg.js',
// '<%= config.jsSrc %>fouterswap.js',
],
@@ -133,22 +133,40 @@ module.exports = function(grunt) {
}
},
compress: {
main: {
mainGzip: {
options: {
mode: 'brotli',
brotli: {
mode: 1
}
mode: 'gzip'
},
// only do HTML files to comply with webmention brid.gy bug https://github.com/snarfed/bridgy/issues/878
// when that bug is fixed, this can go away (and .htaccess stuff for gzip)
files: [
{
expand: true,
cwd: '_site/',
src: ['**/*.html'],
dest: '_site/',
extDot: 'last',
ext: '.html.zbr'
},
ext: '.html.zgz'
}
]
},
mainBrotli: {
options: {
mode: 'brotli',
brotli: {
mode: 1
}
},
files: [
// reenable when bridgy bug above in compress:mainGzip task is fixed.
// {
// expand: true,
// cwd: '_site/',
// src: ['**/*.html'],
// dest: '_site/',
// extDot: 'last',
// ext: '.html.zbr'
// },
{
expand: true,
cwd: '_site/',
@@ -210,7 +228,7 @@ module.exports = function(grunt) {
},
clean: {
drafts: [ '_site/web/drafts/**' ],
compressed: [ '_site/**/*.zbr' ]
compressed: [ '_site/**/*.zbr', '_site/**/*.zgz' ]
},
watch: {
assets: {
@@ -31,7 +31,7 @@ async function fetchWebmentions(since) {
// TODO move to use since_id instead of since date
let url = `${API_ORIGIN}?domain=${domain}&token=${TOKEN}`;
if (since) {
url += `&per-page=100&&since=${since}`;
url += `&per-page=999&&since=${since}`;
} else {
url += `&per-page=999`;
}
@@ -1,6 +1,6 @@
{
"name": "zachleat.com",
"version": "2.0.8",
"version": "2.0.9",
"description": "The website of @zachleat",
"dependencies": {
"fg-loadcss": "^1.3.1",

0 comments on commit 583b0a2

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