Less rules for Bazel
WARNING: this is beta-quality software. Breaking changes are likely. Not recommended for production use without expert support.
The Less rules run the Less CSS preprocessor with Bazel.
@bazel/less npm package to your
WORKSPACE should declare a
npm_install rule named
It should then install the rules found in the npm packages using the
This causes the
@bazel/less package to be installed as a Bazel workspace named
Installing with self-managed dependencies
If you didn't use the
npm_install rule to create an
npm workspace, you'll have to declare a rule in your root
BUILD.bazel file to execute less:
# Create a less rule to use in less_binary#compiler # attribute when using self-managed dependencies nodejs_binary( name = "less_bin", entry_point = "//:node_modules/less/bin/lessc", # Point bazel to your node_modules to find the entry point node_modules = ["//:node_modules"], )
less_binary(name, compiler, deps, sourcemap, src)
(name, mandatory): A unique name for this target.
(label): Label that points to the lessc binary to run.
If you install your npm packages to a workspace named something other than "npm",
you may need to set this to
(Boolean): Generates a sourcemap