Comments (2)
Thanks for your feedback!
I look at it to make it clear on which side the problem: svgo lib or our plugin
from webpack-svgstore-plugin.
Man o man those SVGO docs sure could use some work =P
This was the answer: https://twitter.com/DavidWells/status/741005631734321152
I managed to figure out the solution and exactly how to configure this webpack plugin.
var path = require('path')
var fs = require('fs')
var webpack = require('webpack')
var packageInfo = require('./package')
var SvgStore = require('webpack-svgstore-plugin')
// define local variables
var distPath = path.join(__dirname, 'src', 'sprite')
var sourcePath = path.join(__dirname, 'src', 'assets')
var config = {
entry: {
index: path.join(__dirname, 'src', 'dummy-entry.js'),
},
output: {
path: distPath,
filename: '[name].js',
chunkFilename: '[chunkhash].[id].js',
publicPath: '/lib/'
},
resolve: {
extensions: ['', '.js'],
},
plugins: [
new SvgStore(path.join(sourcePath, '**/*.svg'), path.join('svg'), {
svg: {
xmlns: 'http://www.w3.org/2000/svg',
style: 'position:absolute; width: 0; height: 0'
},
name: 'sprite.svg',
chunk: 'index',
prefix: '',
svgoOptions: {
plugins: [{
cleanupAttrs: true,
}, {
removeDoctype: true,
},{
removeXMLProcInst: true,
},{
removeComments: true,
},{
removeMetadata: true,
},{
removeTitle: true,
},{
removeDesc: true,
},{
removeUselessDefs: true,
},{
removeEditorsNSData: true,
},{
removeEmptyAttrs: true,
},{
removeHiddenElems: true,
},{
removeEmptyText: true,
},{
removeEmptyContainers: true,
},{
removeViewBox: false,
},{
cleanUpEnableBackground: true,
},{
convertStyleToAttrs: true,
},{
convertColors: true,
},{
/* https://github.com/svg/svgo/blob/master/plugins/convertPathData.js#L9-L26 */
//convertPathData: false,
convertPathData: {
applyTransforms: true,
applyTransformsStroked: true,
makeArcs: {
threshold: 2.5, // coefficient of rounding error
tolerance: 0.5 // percentage of radius
},
straightCurves: true,
lineShorthands: true,
curveSmoothShorthands: true,
floatPrecision: 3.33,
transformPrecision: 3,
removeUseless: true,
collapseRepeated: true,
utilizeAbsolute: true,
leadingZero: true,
negativeExtraSpace: true
},
},{
convertTransform: true,
},{
removeUnknownsAndDefaults: true,
},{
removeNonInheritableGroupAttrs: true,
},{
removeUselessStrokeAndFill: true,
},{
removeUnusedNS: true,
},{
cleanupIDs: true,
},{
cleanupNumericValues: true,
},{
moveElemsAttrsToGroup: true,
},{
moveGroupAttrsToElems: true,
},{
collapseGroups: true,
},{
removeRasterImages: false,
},{
mergePaths: true,
},{
convertShapeToPath: true,
},{
sortAttrs: true,
},{
transformsWithOnePath: false,
},{
removeDimensions: true,
},
//{
// removeAttrs: {attrs: '(stroke|fill)'},
// }
]
}
})
],
module: {
loaders: [
{
test: /\.js/,
loaders: ['babel']
}
]
}
}
module.exports = config
from webpack-svgstore-plugin.
Related Issues (20)
- Using variable in 'name' causes errors HOT 2
- In Webpack-dev-server not work added svg-sprite HOT 3
- understand how to use plugin HOT 6
- Nuxt.js HOT 1
- Update Dependencies HOT 2
- Wrong __svg__ filename returns a "Uncaught Error: Invalid SVG Response" HOT 2
- Webpack 3 support HOT 3
- Something weird happens to __svg__ variable HOT 1
- webpack-dev-server 404 HOT 2
- v4.0.2: DOMContentLoaded does not working HOT 5
- Generate output SVG on add/remove input icon file HOT 1
- How to migrate to Webpack4? HOT 6
- Consider to update to lodash >=4.17.5 for security HOT 2
- DeprecationWarning: Tapable.plugin is deprecated HOT 1
- Can I help maintain this project
- NaN in svg path HOT 1
- Sub-domain issue
- Can't get prefixClassNames to work HOT 2
- The transitive dependency [email protected] has a known vulnerability (CVE-2021-3807)
- The transitive dependency [email protected] has known vulnerabilities HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-svgstore-plugin.