Skip to content

Commit

Permalink
Use non-deprecated SVGO options in HTMLNanoOptimizer
Browse files Browse the repository at this point in the history
(Hopefully) fixes parcel-bundler#6744
  • Loading branch information
shish committed Aug 27, 2021
1 parent b858801 commit 7457a4f
Showing 1 changed file with 22 additions and 35 deletions.
57 changes: 22 additions & 35 deletions packages/optimizers/htmlnano/src/HTMLNanoOptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,44 +57,31 @@ export default (new Optimizer({
const htmlNanoConfig = {
minifyJs: false,
minifySvg: {
plugins: extendDefaultPlugins([
// Copied from htmlnano defaults.
plugins: [
{
name: 'collapseGroups',
active: false,
},
{
name: 'convertShapeToPath',
active: false,
},
// Additional defaults to preserve accessibility information.
{
name: 'removeTitle',
active: false,
},
{
name: 'removeDesc',
active: false,
},
{
name: 'removeUnknownsAndDefaults',
name: 'preset-default',
params: {
keepAriaAttrs: true,
keepRoleAttr: true,
overrides: {
// Copied from htmlnano defaults.
collapseGroups: false,
convertShapeToPath: false,
// Additional defaults to preserve accessibility information.
removeTitle: false,
removeDesc: false,
removeUnknownsAndDefaults: {
keepAriaAttrs: true,
keepRoleAttr: true
},
// Do not minify ids or remove unreferenced elements in
// inline SVGs because they could actually be referenced
// by a separate inline SVG.
cleanupIDs: false,
// XML namespaces are not required in HTML.
removeXMLNS: true,
},
},
},
// Do not minify ids or remove unreferenced elements in inline SVGs
// because they could actually be referenced by a separate inline SVG.
{
name: 'cleanupIDs',
active: false,
},
// XML namespaces are not required in HTML.
{
name: 'removeXMLNS',
active: true,
},
]),
}
]
},
...(preset || {}),
...clonedConfig,
Expand Down

0 comments on commit 7457a4f

Please sign in to comment.