diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-01-05 22:10:40 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-01-05 22:10:40 -0500 |
commit | 55eb7636c03f2fb662f05568e732a0264fb840dc (patch) | |
tree | 5342bfc494202e446427b4a5f69f14b2be462e41 /scripts | |
parent | 7746773ab9426c9e7fbccb608ff3199d522a5227 (diff) |
Minify javascript
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/make-assets.sh | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/scripts/make-assets.sh b/scripts/make-assets.sh index 7358470c..8ce7e4e2 100755 --- a/scripts/make-assets.sh +++ b/scripts/make-assets.sh @@ -1,20 +1,38 @@ #!/bin/bash css="base links title table form button alert tooltip header board project task comment subtask markdown listing activity dashboard pagination popover confirm sidebar responsive font-awesome.min jquery-ui-1.10.4.custom chosen.min" -js="jquery-1.11.1.min jquery-ui-1.10.4.custom.min jquery.ui.touch-punch.min chosen.jquery.min base board task analytic init" +js="jquery-1.11.1.min jquery-ui-1.10.4.custom.min jquery.ui.touch-punch.min chosen.jquery.min minify.min" +minify="base board task analytic init" + +rm -f assets/js/minify* 2>/dev/null +rm -f assets/js/app.js 2>/dev/null +rm -f assets/css/app.css 2>/dev/null -rm -f assets/css/app.css echo "/* DO NOT EDIT: auto-generated file */" > assets/css/app.css +# merge css for file in $css do cat "assets/css/${file}.css" >> assets/css/app.css done -rm -f assets/js/app.js -echo "/* DO NOT EDIT: auto-generated file */" > assets/js/app.js +# minify +for file in $minify +do + cat "assets/js/${file}.js" >> assets/js/minify.js +done +curl -s \ +-d compilation_level=SIMPLE_OPTIMIZATIONS \ +-d output_format=text \ +-d output_info=compiled_code \ +--data-urlencode "js_code@assets/js/minify.js" \ +http://closure-compiler.appspot.com/compile > assets/js/minify.min.js + +# concat app.js for file in $js do cat "assets/js/${file}.js" >> assets/js/app.js done + +rm -f assets/js/minify* 2>/dev/null |