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
The exported identifier must be a valid javascript identifier (dashes are not allowed).
80
+
`default` should not be used a export name.
81
+
76
82
77
83
<h2align="center">Examples</h2>
78
84
@@ -81,13 +87,13 @@ Note that spacing is not significant.
81
87
It's often needed to thread `url()`s in the CSS file as imports to other assets.
82
88
You want to add all referenced assets into the dependency graph.
83
89
84
-
This can be achieved by a postcss plugin: postcss-plugin-url.
90
+
This can be achieved by a postcss plugin: postcss-plugin-icss-url.
85
91
86
92
To enable postcss plugins in your CSS pipeline, chain css-loader with postcss-loader.
87
93
Example configuration with style-loader:
88
94
89
95
```js
90
-
consturlPlugin=require("postcss-plugin-url")
96
+
consturlPlugin=require("postcss-plugin-icss-url")
91
97
92
98
rules: [
93
99
{
@@ -118,7 +124,7 @@ rules: [
118
124
It's often needed to use a preprocessor for CSS. Example: SASS.
119
125
120
126
```js
121
-
consturlPlugin=require("postcss-plugin-url")
127
+
consturlPlugin=require("postcss-plugin-icss-url")
122
128
123
129
rules: [
124
130
{
@@ -145,6 +151,67 @@ rules: [
145
151
]
146
152
```
147
153
154
+
### Minimizing CSS
155
+
156
+
For production builds it's useful to minimize the CSS. This can be done via postcss plugin:
157
+
158
+
```js
159
+
constcssnano=require("cssnano")
160
+
161
+
rules: [
162
+
{
163
+
test:/\.css$/,
164
+
rules: [
165
+
{
166
+
issuer: { not:/\.css$/ },
167
+
use:"style-loader"
168
+
},
169
+
{
170
+
use: [
171
+
"css-loader",
172
+
{
173
+
loader:"postcss-loader",
174
+
plugins: [
175
+
cssnano({
176
+
// options
177
+
})
178
+
]
179
+
}
180
+
]
181
+
}
182
+
]
183
+
}
184
+
]
185
+
```
186
+
187
+
### Extract
188
+
189
+
For production builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on. This can be achieved by using the [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) to extract the CSS when running in production mode.
To include source maps set the `sourceMap` option.
200
+
201
+
I. e. the extract-text-webpack-plugin or the style-loader can handle them.
202
+
203
+
They are not enabled by default because they expose a runtime overhead and increase in bundle size (JS source maps do not). In addition to that relative paths are buggy and you need to use an absolute public path which include the server URL.
0 commit comments