Use closure_css_binary to turn stylesheets defined by closure_css_library rules into a single minified CSS file. This rule evaluates Closure-specific syntax (variables, functions, conditionals, mixins) into standard CSS.
Key Features:
- Class Name Minification: By default, it minifies class names (e.g.,
.foo-bar becomes .a-b). To support this, you must use goog.getCssName("foo-bar") in your JavaScript and point the css attribute of your closure_js_binary to this target. - Implicit Outputs:
name.css: The minified CSS file.name.css.map: A CSS sourcemap for browser debugging.name.css.js: A JavaScript file containing goog.setCssNameMapping(). This is used by the build system to sync minified names between CSS and JS. If rendering Soy templates from Java, you may need to parse this file manually.
Orientation Conversion:
If the orientation argument differs from the orientation of the input libraries, the rule will automatically flip 'left' and 'right' values in direction-sensitive style rules.
load("@rules_closure//closure:defs.bzl", "closure_css_binary")
closure_css_binary(
name = "my_css_bin",
deps = ["//path/to:my_css_lib"],
renaming = True,
debug = False,
orientation = "LTR",
)