@aspect_rules_terser//terser:defs.bzl
Public API
Functions & Macros
terser
Run the terser minifier.
Typical example:
load("@aspect_rules_terser//terser:defs.bzl", "terser") terser( name = "out.min", srcs = "input.js", config_file = "terser_config.json", )
Note that the name
attribute determines what the resulting files will be called.
So the example above will output out.min.js
and out.min.js.map
(since sourcemap
defaults to true
).
If the input is a directory, then the output will also be a directory, named after the name
attribute.
Note that this rule is NOT recursive. It assumes a flat file structure. Passing in a folder with nested folder
will result in an empty output directory.
Parameters
*name | A unique name for this target. |
*node_modules | Label pointing to the linked node_modules target where the
|
*srcs | File(s) to minify. Can be If multiple files are passed, terser will bundle them together. |
data | Runtime dependencies to include in binaries/tests that depend on this target. The transitive npm dependencies, transitive sources, default outputs and runfiles of targets in the If this list contains linked npm packages, npm package store targets or other targets that provide NB: Linked npm package targets that are "dev" dependencies do not forward their underlying Default: [] |
sourcemap | Whether to produce a .js.map output Default: True |
config_file | A JSON file containing Terser minify() options. This is the file you would pass to the --config-file argument in terser's CLI.
Will disable the Default: "@aspect_rules_terser//terser/private:terser_config.default.json" |
debug | Configure terser to produce more readable output. Instead of setting this attribute, consider using debugging compilation mode instead Default: False |
args | Additional command line arguments to pass to terser. Terser only parses minify() args from the config file so additional arguments such as Default: [] |
kwargs | Other common arguments such as |
@aspect_rules_terser//terser:dependencies.bzl
Fetch our dependencies that users need as well.
Functions & Macros
http_archive
Parameters
kwargs |
rules_terser_dependencies