Last active
August 29, 2015 14:07
-
-
Save danieltroger/2207e5c5894ef3435462 to your computer and use it in GitHub Desktop.
Minify all phpjs functions into one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Getting/updating phpjs from github..." | |
if [ ! -d phpjs ] | |
then | |
git clone https://github.com/kvz/phpjs | |
else | |
cd phpjs | |
git pull | |
cd .. | |
fi | |
echo "Downloading yui compressor..." | |
if [ ! -f yui.jar ] | |
then | |
# TODO: download latest release | |
wget "https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar" --no-check-certificate -cO yui.jar | |
fi | |
if [ ! -d min ] | |
then | |
echo "Creating output directory..." | |
mkdir min | |
fi | |
echo "Creating filelist..." | |
files=$(find phpjs/functions/ phpjs/experimental/ -name \*.js) | |
echo "Compressing files..." | |
for file in $files | |
do | |
echo "Compressing $file" | |
bname=$(basename $file) | |
java -jar yui.jar $file -o min/$bname | |
done | |
echo "Concatenating files..." | |
cat min/*.js > php.min.js | |
echo "Cleaning up..." | |
echo "Alright, output file is php.min.js" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment