-
Roll Your Own CSS-in-JS Library (4) - Static Extraction
Monday, March 15, 2021
Static extraction is HARD Firstly, the set-up of static extraction is more complicated - there needs to be a build process, and the static extractor needs to fit into that build process. More importantly, static extraction will require some form of static evaluation. Take the following code for example: 1 2 3 4 5 import getColor from "helpers"; const Block = styled({ color: getColor("block"), }); In order to statically generate the css styles, the extractor needs to look at at least one other file called “helpers”.…
css-in-jscssstatic evaluationbabelvisitor patternjavascriptast