UNPKG

@bolt/build-utils

Version:

Build-related utilities and helper scripts used in the Bolt Design System

121 lines (118 loc) 1.89 kB
const SVGO = require('svgo'); // Based on: https://github.com/react-icons/react-icons/blob/master/packages/react-icons/scripts/svgo.js const svgo = new SVGO({ plugins: [ { cleanupAttrs: true, }, { removeDoctype: true, }, { removeXMLProcInst: true, }, { removeComments: true, }, { removeMetadata: true, }, { removeTitle: true, }, { removeDesc: true, }, { removeUselessDefs: true, }, { removeEditorsNSData: true, }, { removeEmptyAttrs: true, }, { removeHiddenElems: true, }, { removeEmptyText: true, }, { removeEmptyContainers: true, }, { removeViewBox: false, }, { cleanupEnableBackground: true, }, { convertStyleToAttrs: true, }, { // Bolt edit from original, don't use `currentColor` convertColors: true, }, { convertPathData: true, }, { convertTransform: true, }, { removeUnknownsAndDefaults: true, }, { removeNonInheritableGroupAttrs: true, }, { removeUselessStrokeAndFill: true, }, { removeUnusedNS: true, }, { cleanupIDs: true, }, { cleanupNumericValues: true, }, { moveElemsAttrsToGroup: true, }, { moveGroupAttrsToElems: true, }, { collapseGroups: true, }, { removeRasterImages: false, }, { mergePaths: true, }, { convertShapeToPath: true, }, { sortAttrs: true, }, { removeDimensions: true, }, { removeAttributesBySelector: { selector: '*:not(svg)', attributes: ['stroke'], }, }, { removeAttrs: { attrs: 'data.*' }, }, ], }); module.exports = { svgo, };