You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-21Lines changed: 11 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Webpack loader for generating external svg symbol sprite files
7
7
8
8
## How it works?
9
9
10
-
svg-sprite-generation-loader is a webpack-loader that takes a multiple svg files, transform them (parse and return as an object with `symbolId`, `attributes` and `content` (disabled by default) keys), optimizes and put them back in one file.
10
+
svg-sprite-generation-loader is a webpack-loader that takes a multiple svg files, optimize them (using [svgo.optimize](https://github.com/svg/svgo#optimize)), transform (parse and return as an object with `symbolId`, `attributes` and `content` (disabled by default) keys) and put them back in one file.
| symbolId |`string` \| `function(iconPath)` - function that takes the file path of the original icon as an argument and returns the symbolId value<br /> In both cases you can use [interpolateName](https://github.com/webpack/loader-utils#interpolatename) patterns |`"[name]"` which is equal to icon filename (without extension). For example, by default symbolId for `file1.svg` file will be `file1`|`<symbol>` `id` attribute value. |
77
-
| addContent |`boolean`|`false`| Add svg content as property to transformed svg object (may increase bundle size when enabled) |
78
-
| attributes |`string[]`|| What attributes of the original svg need to be added to transformed svg object (By default - all) |
| symbolId | `string` \| `function(iconPath)` - function that takes the file path of the original icon as an argument and returns the symbolId value<br /> In both cases you can use [interpolateName](https://github.com/webpack/loader-utils#interpolatename) patterns | `"[name]"` which is equal to icon filename (without extension). For example, by default symbolId for `file1.svg` file will be `file1` | `<symbol>` `id` attribute value. |
68
+
| spriteFilePath | `string` | `sprite.svg` | Path to sprite file.<br /> `webpack.output.path` <br /> is included |
69
+
| svgoOptimize | `boolean` \| `object` | `true` | Enable/Disable/Customize source svg file optimization with [svgo.optimize](https://github.com/svg/svgo#optimize). The following options are used by default: <br /><pre>`{`<br /> `plugins: [`<br /> `{`<br /> `name: 'preset-default',`<br /> `params: {`<br /> `overrides: {`<br /> `removeViewBox: false,`<br /> `},`<br /> `},`<br /> `},`<br /> `'removeXMLNS',`<br /> `],`<br />`}`</pre> You can disable it completely (by passing `false`) or use your own configuration (see [svgo docs](https://github.com/svg/svgo#optimize)) |
70
+
| addContent | `boolean` | `false` | Add svg content as property to transformed svg object (may increase bundle size when enabled) |
0 commit comments