From 49b7c1520145c3e4d7fb0894b25a4a56e7b7044d Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 12 Jan 2021 20:27:59 +0100 Subject: [PATCH] Enable Brotli compression - Compress file AOD. - Let the server only use static files. - Don't add github-pages to jekyll-plugins group, due to the fact github-pages will behave differently when enabling production ENV. - Adds an extra 10s for the `host` to use `./buid.sh` due to compressing all files. - Resolves #2186 --- Gemfile | 8 +++----- Gemfile.lock | 21 +++++++++++++++------ _config.yml | 2 ++ build.sh | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 70f8d954..72cf17ef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,10 @@ source "https://rubygems.org" # Install github-pages gem (https://jekyllrb.com/docs/github-pages/) -gem "github-pages", group: :jekyll_plugins +gem "github-pages" -# Plugins -group :jekyll_plugins do - # example: gem "jekyll-feed", "~> 0.6" -end +# Install jekyll-brotli gem (https://github.com/philnash/jekyll-brotli/) +gem 'jekyll-brotli' # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 9caae865..94039853 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,7 @@ GEM zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) + brotli (0.2.3) coffee-script (2.4.1) coffee-script-source execjs @@ -26,9 +27,11 @@ GEM ffi (>= 1.3.0) eventmachine (1.2.7) execjs (2.7.0) - faraday (1.2.0) + faraday (1.3.0) + faraday-net_http (~> 1.0) multipart-post (>= 1.2, < 3) ruby2_keywords + faraday-net_http (1.0.1) ffi (1.14.2) forwardable-extended (2.6.0) gemoji (3.0.1) @@ -103,6 +106,9 @@ GEM safe_yaml (~> 1.0) jekyll-avatar (0.7.0) jekyll (>= 3.0, < 5.0) + jekyll-brotli (2.2.1) + brotli (~> 0.2.0) + jekyll (>= 3.0, < 5.0) jekyll-coffeescript (1.1.1) coffee-script (~> 2.2) coffee-script-source (~> 1.11.1) @@ -203,21 +209,23 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) - mini_portile2 (2.4.0) + mini_portile2 (2.5.0) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.14.2) + minitest (5.14.3) multipart-post (2.1.1) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - octokit (4.19.0) + nokogiri (1.11.1) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + octokit (4.20.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (3.1.1) + racc (1.5.2) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) @@ -256,6 +264,7 @@ PLATFORMS DEPENDENCIES github-pages + jekyll-brotli tzinfo-data BUNDLED WITH diff --git a/_config.yml b/_config.yml index 25a9c243..41af1412 100644 --- a/_config.yml +++ b/_config.yml @@ -6,7 +6,9 @@ production_url: "https://www.privacytools.io" sass: style: compressed plugins: + - github-pages - jekyll-sitemap + - jekyll-brotli sitemap: file: "/sitemap.xml" include: [".well-known"] diff --git a/build.sh b/build.sh index f17060a4..75dbd529 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh set -e # halt script on error -bundle exec jekyll build +JEKYLL_ENV=production bundle exec jekyll build \ No newline at end of file