diff --git a/build/build.sh b/build/build.sh index b50b590b..449a72d7 100755 --- a/build/build.sh +++ b/build/build.sh @@ -17,9 +17,8 @@ # build.sh MODE # # MODE: -# commented Preprocessed but still formated and commented -# stripped Formated but without comments (default) -# compressed Uses UglifyJS to reduce file size +# commented Preprocessed, still formated and commented +# stripped Preprocessed, formated but without comments if [ $# -eq 0 ] then diff --git a/build/dist.sh b/build/dist.sh index 6283502a..9636ceb3 100755 --- a/build/dist.sh +++ b/build/dist.sh @@ -15,6 +15,8 @@ echo "Building paper.js" ./build.sh +echo "Minifying paper.js" +./minify.sh echo "Building docs" ./docs.sh echo "Zipping paperjs.zip" diff --git a/build/minify-lib.sh b/build/minify-lib.sh new file mode 100755 index 00000000..26abba79 --- /dev/null +++ b/build/minify-lib.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Paper.js +# +# This file is part of Paper.js, a JavaScript Vector Graphics Library, +# based on Scriptographer.org and designed to be largely API compatible. +# http://scriptographer.org/ +# +# Copyright (c) 2011, Juerg Lehni & Jonathan Puckey +# http://lehni.org/ & http://jonathanpuckey.com/ +# +# Distributed under the MIT license. See LICENSE file for details. +# +# All rights reserved. + +uglifyjs ../lib/acorn.js -o ../lib/acorn-min.js -c -m -b ascii_only=true,beautify=false +uglifyjs ../lib/esprima.js -o ../lib/esprima-min.js -c -m -b ascii_only=true,beautify=false diff --git a/build/minify.sh b/build/minify.sh new file mode 100755 index 00000000..55cb93d6 --- /dev/null +++ b/build/minify.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Paper.js +# +# This file is part of Paper.js, a JavaScript Vector Graphics Library, +# based on Scriptographer.org and designed to be largely API compatible. +# http://scriptographer.org/ +# +# Copyright (c) 2011, Juerg Lehni & Jonathan Puckey +# http://lehni.org/ & http://jonathanpuckey.com/ +# +# Distributed under the MIT license. See LICENSE file for details. +# +# All rights reserved. + +uglifyjs ../dist/paper.js -o ../dist/paper-min.js -c unused=false -m -r "_$_,$_" -b ascii_only=true,beautify=false --comments /^!/ diff --git a/build/preprocess.sh b/build/preprocess.sh index 11e66163..d23eebe1 100755 --- a/build/preprocess.sh +++ b/build/preprocess.sh @@ -24,9 +24,8 @@ # preprocess.sh MODE SOURCE DEFINITIONS PREPRO_INCLUDE DESTINATION # # MODE: -# commented Preprocessed but still formated and commented -# stripped Formated but without comments -# compressed Uses UglifyJS to reduce file size +# commented Preprocessed, still formated and commented +# stripped Preprocessed, formated but without comments VERSION=0.3 DATE=$(git log -1 --pretty=format:%ad) @@ -34,15 +33,10 @@ DATE=$(git log -1 --pretty=format:%ad) COMMAND="./prepro.js -d '{ \"version\": $VERSION, \"date\": \"$DATE\" }' -d '$3' -i '$4' $2" case $1 in - stripped) - eval "$COMMAND -c" > $5 - ;; commented) eval $COMMAND > $5 ;; - compressed) - eval $COMMAND > temp.js - uglifyjs temp.js -c unused=false -m -r "_$_,$_" -b ascii_only=true,beautify=false > $5 - rm temp.js + stripped) + eval "$COMMAND -c" > $5 ;; esac diff --git a/dist/.gitignore b/dist/.gitignore index 61f11ea6..a30cf19a 100644 --- a/dist/.gitignore +++ b/dist/.gitignore @@ -1,3 +1,4 @@ +/paper-min.js /paper-server.js /serverdocs/ /paperjs.zip