Hi,
Would it be possible to add an option to remove SVGO's optimisations from the loader completely?
Currently SVGO manages to strip my style tags, even when I set removeStyleElement: false (it strips the style tag from <defs> even after I've set every svgo plugin to false) 馃槙
Literally having exactly the same problem and came here to see if anybody else had as well.
Gonna take a look through the source and see if I can make a PR.
Edit: Made a PR that includes a useSvgo property that can be set to false. In the meantime, you're welcome to use the dev branch for the PR in your package.json:
{
"devDependencies": {
"vue-svg-loader": "sam3d/vue-svg-loader#disable-svgo-option"
}
}
{
test: /\.svg$/,
loader: 'vue-svg-loader',
options: {
useSvgo: false, // (optional) default: true
}
}
@sam3d I created a custom SVG loader to get around what I thought was a vue-svg-loader specific issue and it turns out Vue's vue-template-compiler is the issue. See a relevant comment thread:
https://forum.vuejs.org/t/about-using-style-tags-inside-templates/7275
I've just changed my SVG structure to use attributes where possible and inline the styles where not. 馃槙
@andreasvirkus disabling SVGO is now included in 0.10.0, just pass svgo: false to loader options.
@andreasvirkus disabling SVGO is now included in
0.10.0, just passsvgo: falseto loader options.
Thanks!
Just for example, I used this way in 'vue.config.js' and it worked:
麓
chainWebpack: config => {
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule.use('vue-svg-loader').loader('vue-svg-loader').options({svgo: false})
},
Most helpful comment
@andreasvirkus disabling SVGO is now included in
0.10.0, just passsvgo: falseto loader options.