{
"devDependencies": {
"autoprefixer": "^9.4.3",
"parcel-bundler": "^1.10.3",
"parcel-plugin-purgecss": "^2.1.0",
"parcel-plugin-sitemap": "^2.0.1",
"parcel-plugin-sw-precache": "^1.0.3",
"pug": "^2.0.3",
"stylus": "^0.54.5"
}
}
Should not remove ids from svg when building pug files for prod; not dev.
EDIT: Works as supposed when --no-minify-flag is enabled?
Removes ids from svg when building pug files. But only svg.
PS. Only tried it with inline-svgs
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.11.0 |
| Node | 11.3.0 |
| Yarn | 1.12.3 |
| Operating System | 4.19.12-2-MANJARO |
Oh, thanks! :+1: Nice find!
Do you by any chance know a fix? :smiley_cat:
@Mobilpadde
Add a .htmlnanorc file with
{
"minifySvg": {
"plugins": [
{ "cleanupIDs": false }
]
}
}
Thanks a ton, @mischnic! :dancer: Works like a charm :gem:
This is really weird to track down (i had it happening for me from Vue svg files).
If we're talking good defaults (which is the point of parcel?) I feel this should not be the default for inlined svgs.
If we're talking good defaults (which is the point of parcel?) I feel this should not be the default for inlined svgs.
Might be good to open a PR in htmlnano for this.
The maintainer of htmlnano has been very open to improvements of the defaults in the past.
Adding a .htmlnanorc file to skip svg inline minification works.
{
"minifySvg": false
}
If it appears that your .htmlnanorc file is being ignored, run Parcel with the --no-cache option.
This htmlnano package is breaking html-embedded SVG in various ways (changing styles/attributes, etc.). This doesn't seem like something that should be enabled by default.
Note: for once, Parcel doesn't override the default of https://github.com/posthtml/htmlnano:
https://github.com/parcel-bundler/parcel/blob/2c65fbf911cd1d80fb121178e72148f53f474d61/packages/core/parcel-bundler/src/transforms/htmlnano.js#L7-L16
Maybe this should be fixed in htmlnano?
Or maybe switch to another html minimizer? Surely there are others that are more robust?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.
If it appears that your
.htmlnanorcfile is being ignored, run Parcel with the--no-cacheoption.
or just delete the ".cache" folder before building.
I deleted .parcel-cache and have --no-cache in both parcel serve and parcel build commands. Here's my .htmlnanorc 馃憞
{
"removeUnusedCss": false,
"minifySvg": false
}
But still, IDs are being stripped from inlined SVGs. 馃槙 It would be great if @lustoykov or @Mobilpadde could re-open the issue.
Most helpful comment
@Mobilpadde
Add a
.htmlnanorcfile with