Advanced compilation
The regular build process uses the
Closure Compiler to compress
Blockly. Although the regular build uses
SIMPLE_OPTIMIZATIONS
mode, Blockly also supports the use of
ADVANCED_OPTIMIZATIONS
mode.
Unless you have a specific need to further reduce the compressed size of
Blockly, you should avoid ADVANCED_OPTIMIZATIONS mode. Instead,
you can use the compressed version of Blockly from npm.
Advanced compilation test
Blockly contains a test which builds Blockly and a small test app using
ADVANCED_OPTIMIZATIONS to ensure that new changes remain compatible with
ADVANCED_OPTIMIZATIONS mode.
This ADVANCED_OPTIMIZATIONS test is called compileAdvancedCompilationTest()
and located in packages/blockly/scripts/gulpfiles/build_tasks.mjs.
The associated test app is located in packages/blockly/tests/compile/.
If you want to run this ADVANCED_OPTIMIZATIONS test locally, you can use:
npm run test:compile:advanced
Use advanced compilation
Since ADVANCED_OPTIMIZATIONS includes aggressive renaming, you must compile
Blockly with your own app in order to use it.
You can reference the advanced compilation test and
the associated test app as an example of how to use ADVANCED_OPTIMIZATIONS
mode on your own project. You can also consult the Closure Compiler documentation
on advanced compilation.