From f3c61f52d292ba2fb2e1e9576bd8f4a2959209cb Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Tue, 13 Dec 2022 08:39:43 -0600 Subject: [PATCH] say how much space we saved --- flake.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 1db3efe..ace9e87 100644 --- a/flake.nix +++ b/flake.nix @@ -50,10 +50,11 @@ buildInputs = [ pkgs.nodePackages.clean-css-cli ]; buildPhase = '' - find . \ - -type f -name '*.css' \ - -exec cleancss -O 1 -o {}.min {} \; \ - -exec mv {}.min {} \; + for file in $(find . -type f -name '*.css'); do + cleancss -O 1 -o $file.min $file + printf '%s: %db -> %db\n' "$file" "$(wc -c $file | cut -d ' ' -f 1)" "$(wc -c $file.min | cut -d ' ' -f 1)" + mv $file.min $file + done ''; installPhase = '' @@ -74,10 +75,11 @@ buildInputs = [ pkgs.nodePackages.uglify-js ]; buildPhase = '' - find . \ - -type f -name '*.js' \ - -exec uglifyjs -o {}.min {} \; \ - -exec mv {}.min {} \; + for file in $(find . -type f -name '*.js'); do + uglifyjs -o $file.min $file + printf '%s: %db -> %db\n' "$file" "$(wc -c $file | cut -d ' ' -f 1)" "$(wc -c $file.min | cut -d ' ' -f 1)" + mv $file.min $file + done ''; installPhase = ''