From 76d2cfac4ce00d271606867701dac3d90df1c163 Mon Sep 17 00:00:00 2001 From: Michael <48391407+MichaelJRM@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:54:09 -0300 Subject: [PATCH] Asset minification (#799) * Minify asset on each build * Fix style * Add github action step to install minify * Remove unnecessary require * Remove unnecessary lines --- .github/workflows/build-pr.yml | 3 +++ .github/workflows/build-website.yml | 3 +++ README.md | 8 +++++--- _includes/header.html | 4 +--- _plugins/minify-assets.rb | 5 +++++ 5 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 _plugins/minify-assets.rb diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 9e33e93785..0aa1bf87bb 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -24,6 +24,9 @@ jobs: # Runs 'bundle install' and caches installed gems automatically bundler-cache: true + - name: Install Minify + run: sudo apt-get update && sudo apt-get install minify + # Build the website. - name: Build the static website diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 459d6170a1..7ccd4258e3 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -29,6 +29,9 @@ jobs: # Runs 'bundle install' and caches installed gems automatically bundler-cache: true + - name: Install Minify + run: sudo apt-get update && sudo apt-get install minify + # Build the website. - name: Build the static website diff --git a/README.md b/README.md index eb7cec1227..58d3c5c389 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,11 @@ To build the website locally, follow these steps: 1. Install [Jekyll prerequisites](https://jekyllrb.com/docs/installation/). - Make sure `bundle` is available from the command line. -2. Clone this repository. -3. Install the necessary dependencies: `bundle install`. -4. Build the site: `bundle exec jekyll build`. +2. Install [Minify](https://github.com/tdewolff/minify/tree/master/cmd/minify). + - Make sure `minify` is available from the command line. +3. Clone this repository. +4. Install the necessary dependencies: `bundle install`. +5. Build the site: `bundle exec jekyll build`. - Append `--config _config.yml,_config.development.yml` to use the development config with your build. For simplicity, these two commands are also available as a `build.sh` script in this repository. diff --git a/_includes/header.html b/_includes/header.html index eaed4868d2..e32b4f1eb0 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -14,9 +14,7 @@