rules_terser
v2.1.2
published 5 hours ago
6 stars
4 forks
3 watchers
Apache License 2.0
public
6 assets
661,817 downloads
29 KB
v2.1.2
June 16, 2026
[expand for release notes]

Bazel rules for terser

Note

This repository uses the Aspect CLI for CI and local development. See the docs and install instructions to get started.

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.build/services.

Installation

From the release you wish to use: https://github.com/aspect-build/rules_terser/releases copy the MODULE.bazel snippet into your MODULE.bazel file.

Usage

See the API documentation and the example usage in the examples/ directory.

From a BUILD file

This is the most common usage. See examples/minify

From a macro

You could write a Bazel macro which uses terser, by calling it from a genrule or run_binary. This is illustrated in examples/macro.

From a custom rule

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.