From f22cb1c69ffad334af0fe19c3c350c6e3b51b0b5 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Mon, 28 Dec 2020 09:39:13 -0600 Subject: [PATCH] compress images --- default.nix | 4 ++++ shell.nix | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 4eea08f..7f6b503 100644 --- a/default.nix +++ b/default.nix @@ -12,6 +12,7 @@ in pkgs.stdenv.mkDerivation { pkgs.nodePackages.html-minifier pkgs.nodePackages.clean-css-cli pkgs.nodePackages.uglify-js + pkgs.pngcrush ]; buildPhase = '' zola build @@ -41,6 +42,9 @@ in pkgs.stdenv.mkDerivation { --file-ext html \ --input-dir public \ --output-dir public + + echo "compressing images" + find public -type f -name '*.png' | xargs -n 1 pngcrush -ow -brute ''; installPhase = '' diff --git a/shell.nix b/shell.nix index 56add81..4bcf904 100644 --- a/shell.nix +++ b/shell.nix @@ -7,5 +7,5 @@ let in with nixpkgs; stdenv.mkDerivation { name = "bytes.zone"; - buildInputs = [ niv.niv git zola pa11y.pa11y ]; + buildInputs = [ niv.niv git zola pa11y.pa11y pngcrush ]; }