terser is a JavaScript minifier.
These rules teach Bazel how to interact with the terser CLI.
Need help? This ruleset has support provided by https://aspect.dev.
From the release you wish to use:
https://github.com/aspect-build/rules_terser/releases
copy the WORKSPACE snippet into your WORKSPACE
file.
See the API documentation and the example usage in the examples/
directory.
Note that the examples rely on code in the /WORKSPACE
file in the root of this repo.
This is the most common usage. See examples/minify
You could write a Bazel macro which uses terser, by calling it from a genrule
or
run_binary
.
This is illustrated in examples/macro.
The most advanced usage is to write your own custom rule.
This is a good choice if you need to integrate with other Bazel rules via Providers.