Skip to content

Commit

Permalink
fix svgo
Browse files Browse the repository at this point in the history
  • Loading branch information
laedit committed Aug 1, 2021
1 parent 180d95e commit cf967a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 10 additions & 0 deletions svgo.config.js
@@ -0,0 +1,10 @@
module.exports = {
plugins: [
{
name: 'inlineStyles',
params: {
onlyMatchedOnce: false
}
}
]
}
12 changes: 2 additions & 10 deletions webpack.config.js
Expand Up @@ -2,21 +2,13 @@ var path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
const fs = require('fs')
const SvgoInstance = require('svgo')
const { optimize } = require('svgo');

const entry = require('./package.json').main

const readManifest = () =>
JSON.parse(fs.readFileSync(path.join(__dirname, './manifest.konnector')))

const svgo = new SvgoInstance({
plugins: [
{
inlineStyles: { onlyMatchedOnce: false }
}
]
})

let iconName
try {
iconName = JSON.parse(fs.readFileSync('manifest.konnector', 'utf8')).icon
Expand Down Expand Up @@ -61,7 +53,7 @@ module.exports = {

function optimizeSVGIcon(buffer, path) {
if (appIconRX && path.match(appIconRX)) {
return svgo.optimize(buffer).then(resp => resp.data)
return optimize(buffer).then(resp => resp.data)
} else {
return buffer
}
Expand Down

0 comments on commit cf967a3

Please sign in to comment.