diff --git a/index.js b/index.js index a8b4f8a..9683ee9 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ let mix = require('laravel-mix'); let path = require('path'); -const { extendDefaultPlugins } = require('svgo'); class SvgVue { @@ -29,7 +28,7 @@ class SvgVue { boot() { Mix.listen('configReady', config => { config.module.rules.map(r => { - if (this._isSvgRegExp(r.test) && ! this._isSvgVueRule(r)) { + if (this._isSvgRegExp(r.test) && !this._isSvgVueRule(r)) { r.exclude = path.resolve(__dirname, process.cwd() + '/' + this.options.svgPath); } }); @@ -50,7 +49,14 @@ class SvgVue { { loader: 'svgo-loader', options: { - plugins: extendDefaultPlugins(this._convertSvgoOptions(this.options.svgoSettings)) + plugins: [ + { + name: 'preset-default', + params: { + overrides: this.options.svgoSettings + }, + }, + ], } } ] @@ -102,23 +108,6 @@ class SvgVue { return false; } - _convertSvgoOptions(options) { - let converted = []; - - options.forEach(option => { - let settings = Object.keys(option); - - settings.forEach(setting => { - converted.push({ - name: setting, - active: option[setting] - }); - }); - }); - - return converted; - } - } mix.extend('svgVue', new SvgVue());