linkedin / css-blocks

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

Parallelization #184

Open jamiebuilds opened 6 years ago

jamiebuilds commented 6 years ago

I'm going to break down my current understanding of how CSS blocks works (I think as long as I'm close enough it will work for explanation purposes)

The problem with this design is that in expects to happen in a very specific order and to have all the information it needs before continuing. This means that you cannot parallelize the transformation of CSS Blocks files and JS/HBS files that use CSS Blocks.

In a large app where every component uses CSS Blocks, this will have a really noticeable performance impact, you'll be blocking the transformation of hundreds if not thousands of files on an effectively synchronous process.

So I would like to revisit the design of CSS Blocks to see if there are things that we can do so that JS/HBS files and CSS files can be transformed in parallel, even if it means we have to revisit JS/HBS files after the CSS is done.

These references could be just strings that CSS Blocks is able to identify:

"css-blocks-ref:path/to/button.css:size(small)"

Or maybe something more complex than that. The point is that you could come back later on and map it to something that was calculated in parallel elsewhere.

/cc @devongovett

milandimun commented 5 years ago

@jamiebuilds is it still open? I could work on this.