Skip to content

Instantly share code, notes, and snippets.

@0x07dc
Last active August 29, 2015 14:16
Show Gist options
  • Save 0x07dc/4384257663a524f6c818 to your computer and use it in GitHub Desktop.
Save 0x07dc/4384257663a524f6c818 to your computer and use it in GitHub Desktop.
Find all .js and .css files and run yuicompressor to minify (bash)
print contents of .css:
find /home/user/appfolder/ | grep '\.css' | while read -r i; do cat $i; done
print contents of .js:
find /home/user/appfolder/ | grep '\.js' | while read -r i; do cat $i; done
print contents of .js or .css:??
find /home/user/appfolder/ | grep '\.c{0,1}[sj]s$' | while read -r i; do cat $i; done
css:
find /home/user/appfolder/ | grep '\.css' | while read -r i; do java -jar ~/Programs/yuicompressor/yuicompressor-2.4.8.jar --type css $i > $i'temp947' && mv $i'temp947' $i; done
js:
find /home/user/appfolder/ | grep '\.js' | while read -r i; do java -jar ~/Programs/yuicompressor/yuicompressor-2.4.8.jar --type js $i > $i'temp947' && mv $i'temp947' $i; done
copy folder, chdir, and minicize all js and css files:
cp -R appfolder appfolder-release && cd appfolder-release && find /home/user/appfolder-release/ | grep '\.js' | while read -r i; do java -jar ~/Programs/yuicompressor/yuicompressor-2.4.8.jar --type js $i > $i'temp947' && mv $i'temp947' $i; done && find /home/user/appfolder-release/ | grep '\.css' | while read -r i; do java -jar ~/Programs/yuicompressor/yuicompressor-2.4.8.jar --type css $i > $i'temp947' && mv $i'temp947' $i; done
print all .css files:
find /home/user/appfolder-release/ | grep '\.css' | while read -r i; do cat $i; done
print all .js files:
find /home/user/appfolder-release/ | grep '\.js' | while read -r i; do cat $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment