minify css

This commit is contained in:
Tasia Iso 2024-05-26 23:31:33 +02:00
parent 093dd31a57
commit 2a97fbaafd
Signed by: tasiaiso
SSH key fingerprint: SHA256:KiRjUay5C9i6objsEOIycygBHn54pDBB3Lj7fyJ0Elw
5 changed files with 17 additions and 8 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ site
NOTES.md NOTES.md
theme/*.html theme/*.html
theme/*.min

View file

@ -1,5 +1,8 @@
# $< : first dependency (input)
# $@ : rule name (output)
# Build the website # 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 mkdocs build
theme/main.html: haml/main.haml theme/main.html: haml/main.haml
@ -7,6 +10,9 @@ theme/main.html: haml/main.haml
cat $@.tmp > $@ cat $@.tmp > $@
rm $@.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 the website at http://127.0.0.1:8000/~tasiaiso/
serve: theme/main.html serve: theme/main.html
mkdocs serve -w theme mkdocs serve -w theme
@ -23,6 +29,10 @@ format-markdown:
upload: site/index.html upload: site/index.html
scp -r site/** tasiaiso@tilde.club:/home/tasiaiso/public_html scp -r site/** tasiaiso@tilde.club:/home/tasiaiso/public_html
purge: clean format site/index.html
.PHONY: clean .PHONY: clean
clean: clean:
rm -r site/ rm -r site/
rm theme/main.html
rm theme/style.css.min

View file

@ -7,7 +7,7 @@
%link(rel="icon" type="image/x-icon" href="/~tasiaiso/favicon.ico") %link(rel="icon" type="image/x-icon" href="/~tasiaiso/favicon.ico")
%link(rel="stylesheet" href="/~tasiaiso/gruvbox-dark.css") %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 }} %title {% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }}

View file

@ -6,13 +6,8 @@ theme:
custom_dir: "theme/" custom_dir: "theme/"
plugins: plugins:
# - search
- minify: - minify:
minify_html: true minify_html: true
minify_js: true
minify_css: true
htmlmin_opts: htmlmin_opts:
remove_comments: true remove_comments: true
cache_safe: true reduce_boolean_attributes: true
# css_files:
# - style.css

View file

@ -1,8 +1,11 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
pkgs.mkShell{ pkgs.mkShell{
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
nodejs_20 # EOL: 2026-04
python310 # EOL: 2026
python310Packages.mkdocs python310Packages.mkdocs
python310Packages.mkdocs-minify python310Packages.mkdocs-minify
python310Packages.csscompressor
rubyPackages.haml rubyPackages.haml
]; ];
} }