-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix svg dependencies not being found when using minification #1022
Conversation
src/assets/HTMLAsset.js
Outdated
srcset: ['img', 'source'], | ||
poster: ['video'], | ||
'xlink:href': ['use'], // Deprecated since SVG 2, throws error in svgo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI Chrome doesn’t support the plain href
so it can be “deprecated” but support is 0 as far as I’m concerned. Does this change still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still supported in this PR, don't wanna break cross-browser support.
Dependency collecting (for svgs) is just moved from collectDependencies
into svgDependencyWalker
in this pr (as htmlnano stringifies svgs...)
Therefore it shouldn't be in the Object as walking over a dependency twice would cause parcel to error as the bundles don't exist yet when this is running.
Instead of introducing a separate dependency walker just for SVG, we could do this the same way JSAsset does it. There are both |
Codecov Report
@@ Coverage Diff @@
## master #1022 +/- ##
==========================================
+ Coverage 86.35% 89.79% +3.43%
==========================================
Files 68 70 +2
Lines 3541 3617 +76
==========================================
+ Hits 3058 3248 +190
+ Misses 483 369 -114
Continue to review full report at Codecov.
|
Adds a walker as a plugin that collects svg dependencies before htmlnano is being ran, this enables svg dependency collecting as svgo stringifies the entire svg ast tree removing our ability to walk through it.
Closes #1019