Skip to content

Commit

Permalink
say how much space we saved
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Dec 13, 2022
1 parent 274948e commit f3c61f5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions flake.nix
Expand Up @@ -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 = ''
Expand All @@ -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 = ''
Expand Down

0 comments on commit f3c61f5

Please sign in to comment.