Simple JS closure compiler that communicates with Google Closure Compiler Service
Simple JS closure compiler written in Python that communicates with Google Closure Compiler Service.
Compile a JS file with closure not only reduces the size of the specified files, that is critical in the creation of a modern site, but also ensure
full compatibility with older sites that don’t support the new ECMASCRIPT2016, giving you the possibility to use all of its sugar features.
All you need to do is specify a list of the files you want to be compiled
Put the closure_compiler.py
wherever you want and add all the files you want to compile in the .to_closure_compile
file,
one line per file - relative paths are allowed as well.
Example:
index.html
js/
├─closure_compiler.py
├─elements/
├─topbar.js
├─config.js
├─app.js
elements/topbar.js
config.js
app.js
The compiler can be customized to suit your needs.
The configuration is a json dictionary file, it has to be called .closure_compiler_congif.json
.
However, if no config file it’s specified, the default values will be used instead
Configuration file structure (below are the default values):
{
"url" : "http://closure-compiler.appspot.com/compile",
"compilation_level" : "WHITESPACE_ONLY",
"output_format" : "text",
"output_info" : "compiled_code",
"output_file" : "app.min.js"
}
Python 3
Python’s package requests, you can install it with pip
using the requirements.txt
file with:
pip install -r requirements.txt