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
+40-8Lines changed: 40 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -278,32 +278,64 @@ When writing CSS with the help of a framework (such as [Bootstrap](https://getbo
278
278
279
279
To improve this you can use the [media-query-plugin](https://github.com/SassNinja/media-query-plugin) which plays together well with the mini-css-extract-plugin. It will extract the defined media queries and emit them as separate files (or inject into existing chunks if working with dynamic imports).
280
280
281
-
Afterwards a mobile user only needs to load this
281
+
Afterwards a mobile user needs to load initially
282
282
283
-
```scss
284
-
.foo { color: red }
285
-
.bar { font-size: 1rem }
283
+
**`example.css`**
284
+
```css
285
+
.foo {
286
+
color: red;
287
+
}
288
+
.bar {
289
+
font-size: 1rem;
290
+
}
286
291
```
287
292
288
-
instead of this
293
+
and only if necessary
289
294
295
+
**`example-desktop.css`**
290
296
```css
291
-
.foo { color: red }
292
297
@media (min-width: 75em) {
293
-
.foo { color: blue }
298
+
.foo {
299
+
color: blue;
300
+
}
301
+
}
302
+
```
303
+
304
+
instead of always the full
305
+
306
+
**`example.css`**
307
+
```css
308
+
.foo {
309
+
color: red;
310
+
}
311
+
@media (min-width: 75em) {
312
+
.foo {
313
+
color: blue;
314
+
}
315
+
}
316
+
.bar {
317
+
font-size: 1rem;
294
318
}
295
-
.bar { font-size: 1rem }
296
319
```
297
320
298
321
#### Usage
299
322
300
323
Using the media-query-plugin is quite easy. Add the included loader to your rules and the plugin to your plugins. It will take over the filename option of the mini-css-extract-plugin and recognize its generated CSS chunks.
0 commit comments