From 2a97fbaafdc9300d05bce6698acfe7184d9a2514 Mon Sep 17 00:00:00 2001 From: Tasia Iso Date: Sun, 26 May 2024 23:31:33 +0200 Subject: [PATCH] minify css --- .gitignore | 1 + Makefile | 12 +++++++++++- haml/main.haml | 2 +- mkdocs.yml | 7 +------ shell.nix | 3 +++ 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index e7f292b..ee99d31 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ site NOTES.md theme/*.html +theme/*.min diff --git a/Makefile b/Makefile index 711b2f2..f12437f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ +# $< : first dependency (input) +# $@ : rule name (output) + # Build the website -site/index.html: docs/** theme/** theme/main.html +site/index.html: docs/** theme/** theme/main.html theme/style.css.min mkdocs.yml mkdocs build theme/main.html: haml/main.haml @@ -7,6 +10,9 @@ theme/main.html: haml/main.haml cat $@.tmp > $@ rm $@.tmp +theme/style.css.min: theme/style.css + python3 -m csscompressor -o $@ $< + # Serve the website at http://127.0.0.1:8000/~tasiaiso/ serve: theme/main.html mkdocs serve -w theme @@ -23,6 +29,10 @@ format-markdown: upload: site/index.html scp -r site/** tasiaiso@tilde.club:/home/tasiaiso/public_html +purge: clean format site/index.html + .PHONY: clean clean: rm -r site/ + rm theme/main.html + rm theme/style.css.min diff --git a/haml/main.haml b/haml/main.haml index f1e6be6..fb22e34 100644 --- a/haml/main.haml +++ b/haml/main.haml @@ -7,7 +7,7 @@ %link(rel="icon" type="image/x-icon" href="/~tasiaiso/favicon.ico") %link(rel="stylesheet" href="/~tasiaiso/gruvbox-dark.css") - %link(rel="stylesheet" href="/~tasiaiso/style.css") + %link(rel="stylesheet" href="/~tasiaiso/style.css.min") %title {% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }} diff --git a/mkdocs.yml b/mkdocs.yml index 729f03a..535bfde 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,13 +6,8 @@ theme: custom_dir: "theme/" plugins: - # - search - minify: minify_html: true - minify_js: true - minify_css: true htmlmin_opts: remove_comments: true - cache_safe: true - # css_files: - # - style.css + reduce_boolean_attributes: true diff --git a/shell.nix b/shell.nix index 6c27333..f77a1e9 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,11 @@ { pkgs ? import {} }: pkgs.mkShell{ nativeBuildInputs = with pkgs; [ + nodejs_20 # EOL: 2026-04 + python310 # EOL: 2026 python310Packages.mkdocs python310Packages.mkdocs-minify + python310Packages.csscompressor rubyPackages.haml ]; }