bazelbuild / rules_postcss

PostCSS rules for Bazel
Apache License 2.0
10 stars 13 forks source link

Replace all the PostCSS runner targets created each invocation with a fixed source file #47

Closed rzhw closed 3 years ago

rzhw commented 3 years ago

Currently, postcss_binary expands into three targets:

We don't actually need to embed the plugin config into the PostCSS runner source file. Instead, we can have a single source file, which is fed the plugin config, that then eval()s the plugin arguments defined by the user inside their BUILD files.

(We'll still need to define a nodejs_binary for each postcss_binary instance, because the PostCSS plugins are dynamic. However, a followup optimisation could be allowing users to define a set of plugins used across multiple postcss_binary invocations, which would further cut down the number of nodejs_binary targets. A further optimisation would be to then make this nodejs_binary a worker i.e. #45)

In a large project, this could make a sizeable reduction in the number of targets and source files generated.