Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 18 lines (14 sloc) 460 Bytes
#!/bin/bash
# minifies masonry.js
# requires nodejs & uglifyjs
IN=masonry.js
OUT=masonry.min.js
# remove any lines that begin with /*jshint or /*global
# then, minify with Uglify JS
# then, add newline characters after `*/`, but not last newline character
awk '!/^\/\*[jshint|global]/' $IN \
| uglifyjs \
| awk '{ORS=""; gsub(/\*\//,"*/\n"); if (NR!=1) print "\n"; print;}' > $OUT
# add trailing semicolon
echo ';' >> $OUT
echo "Minified" $IN "as" $OUT