Add optimizer plugin for new CSS compiler#7340
Merged
Merged
Conversation
|
devongovett
commented
Nov 21, 2021
| let map; | ||
| if (result.map != null) { | ||
| map = new SourceMap(options.projectRoot); | ||
| map.addVLQMap(JSON.parse(result.map)); |
Member
Author
There was a problem hiding this comment.
Ideally we'd return a parcel source map directly from @parcel/css. I think we can only return a buffer though, not an actual node source map object (they could be using different versions). But still should be faster than returning and re-parsing VLQ/JSON.
Member
There was a problem hiding this comment.
Does the buffer have a stable format/"ABI"?
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
React HackerNews ✅
Timings
Cold Bundles
Cached Bundles
AtlasKit Editor ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
Three.js ✅
Timings
Cold Bundles
Cached Bundles
|
mischnic
approved these changes
Nov 24, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
@parcel/optimizer-cssplugin, which uses @parcel/css, our new CSS minifier written in Rust. It's significantly faster than cssnano (see readme linked above for benchmarks). For now, it's experimental, so not included in the default config.I'm actually not sure if we want this to eventually be a transformer rather than an optimizer. Eventually it will also perform the work of the current CSS transformer, e.g. extracting dependencies, and there aren't many CSS minification opportunities that will be effective cross file, so probably ok to perform minification in the transformer as well. For now, I put it in an optimizer because minification is the first target.