ubCompileJs – compile Javascript (ECMA) files


ubCompileJs {–application <Unibase application>} {–directory <filesystem directory>} {–file <file name>} {–help} {–verbose}


ubCompileJs takes javascript source files (files of type .src.js) and minifies them using the google-closure-compiler.

To use ubCompileJs you must install npm.

The result of compiling the files is three files of type .min.js and .js for the directory and file options.

For the application option all the source files in $UG_APP/js are combined into a single minified js file called <application>.js

–help give a usage message

–verbose will display it’s progress


ubCompileJs –application uniquote

This will combine all the .src.js files in /usr/local/app/uniquote/js into a single minified js file call /usr/local/app/uniquote/js/application.js. This file is automatically loaded by /usr/local/app/uniquote/inc/bodyInit

ubCompileJs –directory /usr/local/lib/ub/js

This will compile all the .src.js files in /usr/local/lib/ub/js. For each .src.js file you will get a a .min.js file and a .js file that is a symbolic link to the .min.js file.


The original files are kept to make editing and debugging easy. eg You could replace the symbolic link to .min.js with .src.js file or combine all the .src.js files into a sing application file using

cat $UG_APP/js/*.src.js >$UG_APP/js/application.js

Edit/debug and then generate a new compiled application.js