Skip to content

Commit 5cfdfe0

Browse files
committed
handle .icon.svg through svgo
1 parent 752eda4 commit 5cfdfe0

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ module.exports = {
127127
/\.html$/,
128128
/\.(js|jsx)$/,
129129
/\.css$/,
130-
/\.json$/
130+
/\.json$/,
131+
/\.icon\.svg/
131132
],
132133
loader: 'url',
133134
query: {
@@ -172,6 +173,11 @@ module.exports = {
172173
{
173174
test: /\.json$/,
174175
loader: 'json'
176+
},
177+
{
178+
test: /\.icon\.svg/,
179+
exclude: /node_modules/,
180+
loader: 'raw!svgo?'+JSON.stringify({plugins: [{minifyStyles: true}]})
175181
}
176182
]
177183
},

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ module.exports = {
133133
/\.html$/,
134134
/\.(js|jsx)$/,
135135
/\.css$/,
136-
/\.json$/
136+
/\.json$/,
137+
/\.icon\.svg/
137138
],
138139
loader: 'url',
139140
query: {
@@ -182,6 +183,11 @@ module.exports = {
182183
{
183184
test: /\.json$/,
184185
loader: 'json'
186+
},
187+
{
188+
test: /\.icon\.svg/,
189+
exclude: /node_modules/,
190+
loader: 'raw!svgo?'+JSON.stringify({plugins: [{minifyStyles: true}]})
185191
}
186192
]
187193
},

packages/react-scripts/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@
5757
"path-exists": "2.1.0",
5858
"postcss-loader": "1.0.0",
5959
"promise": "7.1.1",
60+
"raw-loader": "^0.5.1",
6061
"react-dev-utils": "^0.3.0",
6162
"recursive-readdir": "2.1.0",
6263
"strip-ansi": "3.0.1",
6364
"style-loader": "0.13.1",
65+
"svgo-loader": "^1.1.2",
6466
"url-loader": "0.5.7",
6567
"webpack": "1.13.2",
6668
"webpack-dev-server": "1.16.2",

0 commit comments

Comments
 (0)