https://github.com/aspect-build/rules_terser
Bazel rules for https://terser.org/ - a JavaScript minifier
https://github.com/aspect-build/rules_terser
bazel bazel-rules
Last synced: 11 months ago
JSON representation
Bazel rules for https://terser.org/ - a JavaScript minifier
- Host: GitHub
- URL: https://github.com/aspect-build/rules_terser
- Owner: aspect-build
- License: apache-2.0
- Created: 2022-04-20T03:14:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-06-20T23:43:11.000Z (about 1 year ago)
- Last Synced: 2025-08-06T16:56:20.634Z (11 months ago)
- Topics: bazel, bazel-rules
- Language: Starlark
- Homepage:
- Size: 216 KB
- Stars: 9
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Bazel rules for terser
[terser](https://terser.org/) is a JavaScript minifier.
These rules teach Bazel how to interact with the [terser CLI](https://terser.org/docs/cli-usage).
_Need help?_ This ruleset has support provided by https://aspect.build/services.
## Installation
From the release you wish to use:
copy the WORKSPACE snippet into your `WORKSPACE` file.
## Usage
See the [API documentation](docs/rules) and the example usage in the [`examples/`](https://github.com/aspect-build/rules_terser/tree/main/examples/) directory.
Note that the examples rely on code in the `/WORKSPACE` file in the root of this repo.
### From a BUILD file
This is the most common usage. See [`examples/minify`](https://github.com/aspect-build/rules_terser/tree/main/examples/)
### From a macro
You could write a Bazel macro which uses terser, by calling it from a `genrule` or
[`run_binary`](https://docs.aspect.build/bazelbuild/bazel-skylib/1.2.1/docs/run_binary_doc_gen.html#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](https://docs.bazel.build/versions/main/skylark/rules.html#providers).