Commit 8e13e2a
committed
perf(transformer/styled-components): simplify CSS minification (#12224)
Simplify CSS minification.
* Remove the step of adding placeholders, which means we also don't need to remove them again, and don't need a hashmap to track which quasis are retained. Instead, just work through the quasis one by one.
* Remove the intermediate `new_raws` `Vec`.
* Skip `\\`, `\'`, `\"` in byte search loop, to avoid backtracking to check for `\"` when exiting a string.
The whole thing squashes down to a single function.
I *believe* I've kept the behavior exactly as it was before. Is there anything I'm missing?
There's one bit of the logic I don't understand. `/* ... */` is replaced with a space, unless there's a space preceding / following it. But I don't think we need to add a space in cases like `height:/* big */${10000}px`. Do we?1 parent 9b14fbc commit 8e13e2a
1 file changed
+221
-337
lines changed
0 commit comments