diff --git a/package.json b/package.json index 02f68e23..f1d613a8 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", "new": "plop", - "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", "test:unit": "jest --clearCache && vue-cli-service test:unit", "test:ci": "npm run lint && npm run test:unit" }, @@ -69,7 +68,8 @@ "script-ext-html-webpack-plugin": "2.1.3", "serve-static": "1.13.2", "svg-sprite-loader": "4.1.3", - "svgo": "1.2.0", + "svgo-loader": "^3.0.0", + "svgo": "^2.3.0", "vue-template-compiler": "2.6.10" }, "browserslist": [ diff --git a/src/icons/svgo.yml b/src/icons/svgo.yml deleted file mode 100644 index d11906ae..00000000 --- a/src/icons/svgo.yml +++ /dev/null @@ -1,22 +0,0 @@ -# replace default config - -# multipass: true -# full: true - -plugins: - - # - name - # - # or: - # - name: false - # - name: true - # - # or: - # - name: - # param1: 1 - # param2: 2 - -- removeAttrs: - attrs: - - 'fill' - - 'fill-rule' diff --git a/vue.config.js b/vue.config.js index 33a63483..9edfa9b5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,7 @@ 'use strict' const path = require('path') const defaultSettings = require('./src/settings.js') +const { extendDefaultPlugins } = require('svgo') function resolve(dir) { return path.join(__dirname, dir) @@ -80,6 +81,19 @@ module.exports = { symbolId: 'icon-[name]' }) .end() + .use('svgo-loader') + .loader('svgo-loader') + .options({ + plugins: extendDefaultPlugins([ + { + name: 'removeAttrs', + params: { + attrs: ['fill', 'fill-rule'] + } + } + ]) + }) + .end() config .when(process.env.NODE_ENV !== 'development',