initial commit, build is not working
This commit is contained in:
27
src/modules/svgo.config.ts
Normal file
27
src/modules/svgo.config.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { SVGOConfig, SvgOptimizeConfig } from '../config';
|
||||
|
||||
const defaultConfig: SVGOConfig = [
|
||||
{
|
||||
removeAttrs: {
|
||||
attrs: '(width|height)'
|
||||
},
|
||||
},
|
||||
{ removeViewBox: false }
|
||||
];
|
||||
|
||||
export function makeConfig(config?: SvgOptimizeConfig): SVGOConfig {
|
||||
|
||||
if (config !== undefined) {
|
||||
const { attrs, removeViewBox } = config;
|
||||
|
||||
if (attrs !== undefined) {
|
||||
defaultConfig[0].removeAttrs.attrs = `(${attrs.replace(/,\s/g, '|')})`;
|
||||
}
|
||||
|
||||
if (removeViewBox) {
|
||||
defaultConfig[1].removeViewBox = removeViewBox;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultConfig;
|
||||
}
|
Reference in New Issue
Block a user