-
-
Notifications
You must be signed in to change notification settings - Fork 40
Conversation
Merging with red tests - the failure is not caused by this PR - its just flaky test. |
@vakrilov can you explain a little bit why it is better? Is it faster to load? Did you compare the size? |
The size of the bundle is bigger. Don't have the exact measurements - but parsed JSON is bigger than it's CSS equivalent. Run-time performance is much better though - on slower devices we have observed performance increase from 1.2s to 50ms (this is theme parsing only). The new |
@vakrilov ok got it. Dont use THanks again for your answer, and your amazing work ! |
Vue and Angular have their own way of handling component-level CSS. They process the CSS additionally to add component scope (usually implemented by adding attribute selectors). Passing pre-compiled CSS to JSON will not work in that case. In any case - the component level CSSis usually not that big and run-time parsing is good enough in that case. You will have perf problems if you import the whole theme in a component, but that is not recommended. |
PR Checklist
What is the current behavior?
Css files are loaded with
css-loader
What is the new behavior?
Use the
css2json
that does parsing the CSS files and puts parsed CSS AST (as json) in the bundle.