-
-
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
svgo.config.json doesn't work, but svgo.config.js does #8270
Comments
#7741 is related. Currently we also don't invalidate the cache if the svgo config used by that transformer changes. |
I came across this bug as well and I am not sure this is a cache invalidation issue (though the cache is a real PITA). The configuration in An hour later: I realized also that since I am inlining some of my SVGs for those I have to configure |
Same here. And I'm sure it's not a cache invalidation issue. It seems the svgo.config.json is not recognized at all. We came across this issue months ago, then I had to switch to js config in order to make it work. But now since we are switching to ESM and then the js config is not working, either... Even we have tried renaming it to So there's no way to get around this now. Any help would be greatly appreciated... Update: |
Parcel 2.9.2 ignores all SVGO configuration files. svgo.config.json, All are completely ignored and there is no way to configure SVGO with Parcel. |
Here is the current list: parcel/packages/optimizers/svgo/src/SVGOOptimizer.js Lines 11 to 16 in 76aa20f
However, that only applies for standalone SVG files. For HTML, you need to configure htmlnano instead |
But SVG page in documentation clearly lists inline SVG https://parceljs.org/languages/svg/#inline-svg and svgo.config.json for minification https://parceljs.org/languages/svg/#minification Just tried .htmlnanorc.json after removing .parcel-cache, it was also ignored. // .htmlnanorc.json
{
"minifySvg": {
"plugins": [
{
"name": "preset-default",
"params": {
"overrides": {
"removeViewBox": false,
"cleanupIDs": false,
"collapseGroups": false
}
}
}
]
}
} IDs are still removed from SVGs. Just for confirmation changed removeViewBox to true, but they are still there. But disabling minifySvg completely works fine. // .htmlnanorc.json
{
"minifySvg": false
} |
When using
@parcel/transformer-svg-react
, I noticed that it was stripping the viewBox attribute.I tried enabling it, but this didn't work:
After trying different things and removing .parcel-cache, changing config to a .js file worked:
Parcel packages used:
The text was updated successfully, but these errors were encountered: