-
Notifications
You must be signed in to change notification settings - Fork 1
Task: Javascript Compiler
TekMonks edited this page Aug 13, 2020
·
3 revisions
This is a highly parallel compilation task for minifying Javascript files. It can accept a bundle of files, and compile them in parallel.
The supported compilers are
- Google Closure Compiler
- Terser
Usage
const {js_compile} = require(`${CONSTANTS.EXTDIR}/js_compiler.js`);
...
...
js_compile(input_file, output_file, useTerser=false);
...
...
The given Javascript files are run through the Javascript closure compiler and the output file will contain the compiled file. If the path for the output file doesn't exist, it will be created, recursively if needed.
If the useTerser option is present and set to true then Terser will be used, else Google Closure Compiler will be used.
See the file samples/jscompile.xf.js for a working sample.
Usage for the sample
node xforge -c -f samples/jscompile.xf.js -o <input path containing JS files> -o <output path> [-o terser]