fix(bundling): correctly generate minified css bundle #1595
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.
STACKS-366
Context
While merging dependabot PRs I noticed that we got a lot of warning when running npm run build.
The command, between other things, creates a minified version of our css bundle using
cssnano
.cssnano
runs its default presets that includespostcss-svgo
andpostcss-calc
. Those plugins were responsible for the warnings and the incorrect minification of our data-uri svg images.More specifically
postcss-svgo
does not play well with data-uris not containing a semicolon after the mediatype:data:image/svg+xml,%3Csvg ...
will yield this warningNon-whitespace before first tag
and incorrectly optimize the svg. For now I managed to make svgo behave correctly by simply adding a semicolon after the mediatype (this should not be necessary according to the data uri scheme). Other solutions could be:%3C
to<
- like what they do in the postcss-svgo example docs)How to test
To test that the bundle is minified correctly and the confetti animation works as expected you can serve (
npx serve
) this content in an temporarytest.html
file at the root level of this repo.No warning should be showed when running
npm run build
. Tests and Linters should pass.This PR also updates all remaining dependencies. All minor updates apart from the vitest update which is the reason of why the snapshot files has changed (if you look carefully you can notice that only some backward slashes have been removed which is a good thing and no real regression is happening in the PR).
Here you can find a diff checker link comparing stacks.min.css before and after the PR