linkedin / css-blocks

High performance, maintainable stylesheets.
http://css-blocks.com/
BSD 2-Clause "Simplified" License
6.34k stars 152 forks source link

Ensure css-block rebuilds are a no-op if no templates or blocks change #493

Closed chriseppstein closed 4 years ago

chriseppstein commented 4 years ago

We got a bug report that during ember serve, some unnecessary css-blocks work is occurring when an change not pertaining to templates or block files has occurred.

chriseppstein commented 4 years ago

I investigated this. Some CSS Blocks get parsed with every rebuild, even if no templates or blocks change. This is because the superclass build method from broccoli-persistent-filter is in charge of skipping the build based on its understanding of what files and their dependencies have changed. But we have to pass in fully parsed blocks before the superclass build is ran because our parsing code is async and the plugin APIs we're integrating with are not.

With changes to both broccoli-persistent-filter and to ember-cli-htmlbars we could avoid this work, but unfortunately navigating getting patches into those projects in a timely manner isn't possible so this is out of scope for our MVP release.

The good news is that although we do some work that should be possible to avoid, we don't change the output files of our broccoli trees unless a real change occurs. That means that the downstream broccoli trees don't get triggered to run.

chriseppstein commented 4 years ago

We have a synchronous block parser now so this work can be avoided.