2022-12-21 14:56:09 +03:00
|
|
|
export default {
|
2021-02-21 15:48:30 +03:00
|
|
|
multipass: true,
|
2021-11-29 20:59:11 +03:00
|
|
|
eol: 'lf',
|
2021-08-23 10:43:03 +03:00
|
|
|
plugins: [
|
2021-11-29 20:59:11 +03:00
|
|
|
'cleanupAttrs',
|
|
|
|
'inlineStyles',
|
|
|
|
'removeDoctype',
|
|
|
|
'removeXMLProcInst',
|
|
|
|
'removeComments',
|
|
|
|
'removeMetadata',
|
|
|
|
'removeDesc',
|
|
|
|
'removeUselessDefs',
|
|
|
|
'removeEditorsNSData',
|
|
|
|
'removeEmptyAttrs',
|
|
|
|
'removeHiddenElems',
|
|
|
|
'removeEmptyText',
|
|
|
|
'removeEmptyContainers',
|
|
|
|
'cleanupEnableBackground',
|
2021-02-21 15:48:30 +03:00
|
|
|
{
|
2021-11-29 20:59:11 +03:00
|
|
|
name: 'convertPathData',
|
2021-02-21 15:48:30 +03:00
|
|
|
params: {
|
2021-11-29 20:59:11 +03:00
|
|
|
// 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 15:48:30 +03:00
|
|
|
},
|
|
|
|
},
|
2021-11-29 20:59:11 +03:00
|
|
|
'convertTransform',
|
|
|
|
{
|
|
|
|
name: 'removeUnknownsAndDefaults',
|
|
|
|
params: {
|
|
|
|
// Keep the 'role' attribute, if it's already defined
|
|
|
|
keepRoleAttr: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'removeNonInheritableGroupAttrs',
|
|
|
|
{
|
|
|
|
// Remove paths with fill="none"
|
|
|
|
name: 'removeUselessStrokeAndFill',
|
|
|
|
params: {
|
|
|
|
removeNone: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'removeUselessStrokeAndFill',
|
|
|
|
'removeUnusedNS',
|
2022-11-24 16:39:11 +03:00
|
|
|
'cleanupIds',
|
2021-11-29 20:59:11 +03:00
|
|
|
'cleanupNumericValues',
|
|
|
|
'cleanupListOfValues',
|
|
|
|
'moveGroupAttrsToElems',
|
|
|
|
'collapseGroups',
|
|
|
|
'removeRasterImages',
|
|
|
|
{
|
|
|
|
// Compound all <path>s into one
|
|
|
|
name: 'mergePaths',
|
|
|
|
params: {
|
|
|
|
force: true,
|
|
|
|
noSpaceAfterFlags: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Convert basic shapes (such as <circle>) to <path>
|
|
|
|
name: 'convertShapeToPath',
|
|
|
|
params: {
|
|
|
|
// including <arc>
|
|
|
|
convertArcs: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'convertEllipseToCircle',
|
|
|
|
{
|
|
|
|
// Sort the attributes on the <svg> tag
|
|
|
|
name: 'sortAttrs',
|
|
|
|
params: {
|
|
|
|
order: ['role', 'viewBox'],
|
|
|
|
xmlnsOrder: 'end',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'sortDefsChildren',
|
|
|
|
'removeDimensions',
|
|
|
|
{
|
|
|
|
name: 'removeAttrs',
|
|
|
|
params: {
|
|
|
|
attrs: ['svg:(?!(role|viewBox|xmlns))', 'path:(?!d)', 'title:*'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'removeElementsByAttr',
|
|
|
|
{
|
|
|
|
// Keep the role="img" attribute and automatically add it
|
|
|
|
// to the <svg> tag if it's not there already
|
|
|
|
name: 'addAttributesToSVGElement',
|
|
|
|
params: {
|
|
|
|
attributes: [{ role: 'img', xmlns: 'http://www.w3.org/2000/svg' }],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'removeOffCanvasPaths',
|
|
|
|
'removeStyleElement',
|
|
|
|
'removeScriptElement',
|
|
|
|
'reusePaths',
|
2021-08-23 10:43:03 +03:00
|
|
|
],
|
2021-02-21 15:48:30 +03:00
|
|
|
};
|