File tree Expand file tree Collapse file tree 1 file changed +59
-2
lines changed Expand file tree Collapse file tree 1 file changed +59
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,59 @@ Note: babel transform is applied with `react` and `es2015-loose` presets.
5050}
5151```
5252
53+ ### SVGO options
54+
55+ #### Webpack 1.x
56+
57+ ``` js
58+ {
59+ test: / \. svg$ / ,
60+ loader: ' react-svg' ,
61+ query: {
62+ es5: true ,
63+ svgo: {
64+ // svgo options
65+ plugins: [{removeTitle: false }],
66+ floatPrecision: 2
67+ }
68+ }
69+ }
70+ ```
71+
72+ or if you're using with babel-loader, you can
73+
74+ ``` js
75+ {
76+ test: / \. svg$ / ,
77+ loader: ' babel!react-svg?' + JSON .stringify ({
78+ svgo: {
79+ // svgo options
80+ plugins: [{removeTitle: false }],
81+ floatPrecision: 2
82+ }
83+ }),
84+ }
85+ ```
86+
87+ #### Webpack 2.x
88+
89+ ``` js
90+ {
91+ test: / \. svg$ / ,
92+ loaders: [ ' babel' ,
93+ {
94+ loader: ' react-svg' ,
95+ query: {
96+ svgo: {
97+ plugins: [{removeTitle: false }],
98+ floatPrecision: 2
99+ }
100+ }
101+ }
102+ ]
103+ }
104+ ```
105+
53106## Internals
54107
55108<p align =" center " >
@@ -182,8 +235,12 @@ in the **SAME directory** as the files
182235
183236### CLI Options
184237
185- + ` --es5 ` : Transforms ES2015+JSX output to ES5 using ` presets=[es2015-loose, react] `
186- + ` -0 ` : Outputs to STDOUT
238+ + ` -5 ` | ` --es5 ` : Transforms ES2015+JSX output to ES5 using ` presets=[es2015-loose, react] `
239+ + ` -0 ` | ` --stdout ` : Outputs to STDOUT
240+ + ` --svgo <config_file> ` : Supports SVGO Config YAML / JSON / JS
241+ + ` --svgo.plugins <...plugins> ` : Takes in an array of plugins that need to be enabled
242+ + ` --svgo.plugins.<plugin> <true|false> ` : - Enable/Disable the plugin
243+ + ` --svgo.floatPrecision $N ` : Set floatPrecision to ` N ` for SVGO. SVGO supports 1-8.
187244
188245```
189246`npm bin`/svg2react file1.svg --es5 -0
You can’t perform that action at this time.
0 commit comments