NAME
ubCompileJs – compile Javascript (ECMA) files
SYNOPSIS
ubCompileJs {–application <Unibase application>} {–directory <filesystem directory>} {–file <file name>} {–help} {–verbose}
DESCRIPTION
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, the build process combines all source files in $UG_APP/js
into a single minified JavaScript file named [app_name].js
.
–help give a usage message
–verbose will display it’s progress
EXAMPLES
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. When it executes, /usr/local/app/uniquote/inc/bodyInit
automatically loads this file.
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.
NOTES
Retaining the original source files makes editing and debugging easy. For instance, developers can replace the symbolic link to the minified .js
file with the source .js
file, or combine all the source .js
files into a single application file using [Specify the tool or method used for combining].sing
cat $UG_APP/js/*.src.js >$UG_APP/js/application.js
Edit/debug and then generate a new compiled application.js