2021-02-21 14:48:30 +02:00
|
|
|
module.exports = {
|
|
|
|
multipass: true,
|
2021-08-23 09:43:03 +02:00
|
|
|
plugins: [
|
2021-02-21 14:48:30 +02:00
|
|
|
{
|
2021-08-23 09:43:03 +02:00
|
|
|
name: 'preset-default',
|
2021-02-21 14:48:30 +02:00
|
|
|
params: {
|
2021-08-23 09:43:03 +02:00
|
|
|
overrides: {
|
|
|
|
// customize options
|
|
|
|
convertPathData: {
|
|
|
|
// 3 decimals of precision in floating point numbers
|
|
|
|
floatPrecision: 3,
|
|
|
|
// Some editors (e.g. Adobe Illustrator and Sketch) cannot parse flags
|
|
|
|
// without space wrapping
|
|
|
|
noSpaceAfterFlags: false,
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Sort the attributes on the <svg> tag
|
|
|
|
sortAttrs: {
|
|
|
|
order: ['role', 'viewBox'],
|
|
|
|
xmlnsOrder: 'end',
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Convert basic shapes (such as <circle>) to <path>
|
|
|
|
convertShapeToPath: {
|
|
|
|
// including <arc>
|
|
|
|
convertArcs: true,
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Compound all <path>s into one
|
|
|
|
mergePaths: {
|
|
|
|
force: true,
|
|
|
|
noSpaceAfterFlags: false,
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Keep the <title> tag
|
|
|
|
removeTitle: false,
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Keep the role="img" attribute and automatically add it
|
|
|
|
// to the <svg> tag if it's not there already
|
|
|
|
addAttributesToSVGElement: {
|
|
|
|
attributes: [
|
|
|
|
{role: 'img'},
|
|
|
|
],
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Keep the 'role' attribute, if it's already defined
|
|
|
|
removeUnknownsAndDefaults: {
|
|
|
|
keepRoleAttr: true,
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Remove all attributes except 'role', 'viewBox', and 'xmlns' from
|
|
|
|
// <svg> tags
|
|
|
|
removeAttrs: {
|
|
|
|
attrs: [
|
|
|
|
'baseProfile',
|
|
|
|
'version',
|
|
|
|
'fill-rule',
|
|
|
|
],
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
|
2021-08-23 09:43:03 +02:00
|
|
|
// Remove paths with fill="none"
|
|
|
|
removeUselessStrokeAndFill: {
|
|
|
|
removeNone: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
// Explicitly enable everything else
|
|
|
|
removeDoctype: true,
|
|
|
|
removeXMLProcInst: true,
|
|
|
|
removeComments: true,
|
|
|
|
removeMetadata: true,
|
|
|
|
removeEditorsNSData: true,
|
|
|
|
cleanupAttrs: true,
|
|
|
|
inlineStyles: true,
|
|
|
|
minifyStyles: true,
|
|
|
|
convertStyleToAttrs: true,
|
|
|
|
cleanupIDs: true,
|
|
|
|
prefixIds: true,
|
|
|
|
removeRasterImages: true,
|
|
|
|
removeUselessDefs: true,
|
|
|
|
cleanupNumericValues: true,
|
|
|
|
cleanupListOfValues: true,
|
|
|
|
convertColors: true,
|
|
|
|
removeNonInheritableGroupAttrs: true,
|
|
|
|
removeViewBox: true,
|
|
|
|
cleanupEnableBackground: true,
|
|
|
|
removeHiddenElems: true,
|
|
|
|
removeEmptyText: true,
|
|
|
|
moveElemsAttrsToGroup: true,
|
|
|
|
moveGroupAttrsToElems: true,
|
|
|
|
collapseGroups: true,
|
|
|
|
convertTransform: true,
|
|
|
|
removeEmptyAttrs: true,
|
|
|
|
removeEmptyContainers: true,
|
|
|
|
removeUnusedNS: true,
|
|
|
|
removeDesc: true,
|
|
|
|
removeDimensions: true,
|
|
|
|
removeStyleElement: true,
|
|
|
|
removeScriptElement: true,
|
|
|
|
removeOffCanvasPaths: true,
|
|
|
|
reusePaths: true,
|
|
|
|
},
|
2021-02-21 14:48:30 +02:00
|
|
|
},
|
|
|
|
},
|
2021-08-23 09:43:03 +02:00
|
|
|
],
|
2021-02-21 14:48:30 +02:00
|
|
|
};
|