Asset minification (#799)

* Minify asset on each build

* Fix style

* Add github action step to install minify

* Remove unnecessary require

* Remove unnecessary lines
This commit is contained in:
Michael
2024-02-19 11:54:09 -03:00
committed by GitHub
parent 01b5e44341
commit 76d2cfac4c
5 changed files with 17 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -14,9 +14,7 @@
<nav id="nav">
<ul class="left">
<li><a href="/features">Features</a></li>
<div class="only-on-mobile" style="width: 100%">
<li><a href="/showcase">Showcase</a></li>
</div>
<li class="only-on-mobile"><a href="/showcase">Showcase</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/community">Community</a></li>
<li><a href="/contact">About</a></li>

View File

@@ -0,0 +1,5 @@
# Minify assets after each build
Jekyll::Hooks.register :site, :post_write do
puts "Minifying assets"
`minify -r -o _site/ _site/`
end