Minify and compress files from shell

find ./ -type f \
    -name "*.js" ! -name "*.min.*" ! -name "vfs_fonts*" \
    -exec echo {} \; \
    -exec uglifyjs -o {}.min {} \; \
    -exec rm {} \; \
    -exec mv {}.min {} \;

#minification of CSS files
cd /var/www/hetluxebuitenleven.nl/web/pub/media/porto;
find ./ -type f \
    -name "*.css" ! -name "*.min.*" \
    -exec echo {} \; \
    -exec uglifycss --output {}.min {} \; \
    -exec rm {} \; \
    -exec mv {}.min {} \;

cd /var/www/hetluxebuitenleven.nl/web/pub/media/porto;	
find ./ -type f \
    -name "*.html" ! -name "*.min.*" ! -name "vfs_fonts*" \
    -exec echo {} \; \
    -exec htmlmin -o {}.min {} \; \
    -exec rm {} \; \
    -exec mv {}.min {} \;
Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp