css-loader 2.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,7 +42,7 @@ module.exports = {
42
42
  module: {
43
43
  rules: [
44
44
  {
45
- test: /\.css$/,
45
+ test: /\.css$/i,
46
46
  use: ['style-loader', 'css-loader'],
47
47
  },
48
48
  ],
@@ -65,7 +65,7 @@ module.exports = {
65
65
  module: {
66
66
  rules: [
67
67
  {
68
- test: /\.css$/,
68
+ test: /\.css$/i,
69
69
  use: ['to-string-loader', 'css-loader'],
70
70
  },
71
71
  ],
@@ -95,7 +95,7 @@ module.exports = {
95
95
  module: {
96
96
  rules: [
97
97
  {
98
- test: /\.css$/,
98
+ test: /\.css$/i,
99
99
  use: [
100
100
  'handlebars-loader', // handlebars loader expects raw resource string
101
101
  'extract-loader',
@@ -109,23 +109,23 @@ module.exports = {
109
109
 
110
110
  ## Options
111
111
 
112
- | Name | Type | Default | Description |
113
- | :-----------------------------------------: | :-------------------: | :-------------: | :------------------------------------------ |
114
- | **[`url`](#url)** | `{Boolean\|Function}` | `true` | Enable/Disable `url()` handling |
115
- | **[`import`](#import)** | `{Boolean\/Function}` | `true` | Enable/Disable @import handling |
116
- | **[`modules`](#modules)** | `{Boolean\|String}` | `false` | Enable/Disable CSS Modules and setup mode |
117
- | **[`localIdentName`](#localidentname)** | `{String}` | `[hash:base64]` | Configure the generated ident |
118
- | **[`sourceMap`](#sourcemap)** | `{Boolean}` | `false` | Enable/Disable Sourcemaps |
119
- | **[`camelCase`](#camelcase)** | `{Boolean\|String}` | `false` | Export Classnames in CamelCase |
120
- | **[`importLoaders`](#importloaders)** | `{Number}` | `0` | Number of loaders applied before CSS loader |
121
- | **[`exportOnlyLocals`](#exportonlylocals)** | `{Boolean}` | `false` | Export only locals |
112
+ | Name | Type | Default | Description |
113
+ | :-----------------------------------------: | :-------------------------: | :-----: | :--------------------------------------------------------------------- |
114
+ | **[`url`](#url)** | `{Boolean\|Function}` | `true` | Enables/Disables `url`/`image-set` functions handling |
115
+ | **[`import`](#import)** | `{Boolean\|Function}` | `true` | Enables/Disables `@import` at-rules handling |
116
+ | **[`modules`](#modules)** | `{Boolean\|String\|Object}` | `false` | Enables/Disables CSS Modules and their configuration |
117
+ | **[`sourceMap`](#sourcemap)** | `{Boolean}` | `false` | Enables/Disables generation of source maps |
118
+ | **[`importLoaders`](#importloaders)** | `{Number}` | `0` | Enables/Disables or setups number of loaders applied before CSS loader |
119
+ | **[`localsConvention`](#localsconvention)** | `{String}` | `asIs` | Style of exported classnames |
120
+ | **[`onlyLocals`](#onlylocals)** | `{Boolean}` | `false` | Export only locals |
122
121
 
123
122
  ### `url`
124
123
 
125
124
  Type: `Boolean|Function`
126
125
  Default: `true`
127
126
 
128
- Control `url()` resolving. Absolute urls are not resolving.
127
+ Enables/Disables `url`/`image-set` functions handling.
128
+ Control `url()` resolving. Absolute URLs and root-relative URLs are not resolving.
129
129
 
130
130
  Examples resolutions:
131
131
 
@@ -157,7 +157,7 @@ module.exports = {
157
157
  module: {
158
158
  rules: [
159
159
  {
160
- test: /\.css$/,
160
+ test: /\.css$/i,
161
161
  loader: 'css-loader',
162
162
  options: {
163
163
  url: true,
@@ -179,14 +179,18 @@ module.exports = {
179
179
  module: {
180
180
  rules: [
181
181
  {
182
- test: /\.css$/,
182
+ test: /\.css$/i,
183
183
  loader: 'css-loader',
184
184
  options: {
185
185
  url: (url, resourcePath) => {
186
186
  // resourcePath - path to css file
187
187
 
188
- // `url()` with `img.png` stay untouched
189
- return url.includes('img.png');
188
+ // Don't handle `img.png` urls
189
+ if (url.includes('img.png')) {
190
+ return false;
191
+ }
192
+
193
+ return true;
190
194
  },
191
195
  },
192
196
  },
@@ -200,6 +204,7 @@ module.exports = {
200
204
  Type: `Boolean`
201
205
  Default: `true`
202
206
 
207
+ Enables/Disables `@import` at-rules handling.
203
208
  Control `@import` resolving. Absolute urls in `@import` will be moved in runtime code.
204
209
 
205
210
  Examples resolutions:
@@ -233,7 +238,7 @@ module.exports = {
233
238
  module: {
234
239
  rules: [
235
240
  {
236
- test: /\.css$/,
241
+ test: /\.css$/i,
237
242
  loader: 'css-loader',
238
243
  options: {
239
244
  import: true,
@@ -255,7 +260,7 @@ module.exports = {
255
260
  module: {
256
261
  rules: [
257
262
  {
258
- test: /\.css$/,
263
+ test: /\.css$/i,
259
264
  loader: 'css-loader',
260
265
  options: {
261
266
  import: (parsedImport, resourcePath) => {
@@ -263,8 +268,12 @@ module.exports = {
263
268
  // parsedImport.media - media query of `@import`
264
269
  // resourcePath - path to css file
265
270
 
266
- // `@import` with `style.css` stay untouched
267
- return parsedImport.url.includes('style.css');
271
+ // Don't handle `style.css` import
272
+ if (parsedImport.url.includes('style.css')) {
273
+ return false;
274
+ }
275
+
276
+ return true;
268
277
  },
269
278
  },
270
279
  },
@@ -273,24 +282,17 @@ module.exports = {
273
282
  };
274
283
  ```
275
284
 
276
- ### [`modules`](https://github.com/css-modules/css-modules)
285
+ ### `modules`
277
286
 
278
- Type: `Boolean|String`
287
+ Type: `Boolean|String|Object`
279
288
  Default: `false`
280
289
 
281
- The `modules` option enables/disables the **CSS Modules** spec and setup basic behaviour.
290
+ Enables/Disables CSS Modules and their configuration.
282
291
 
283
- | Name | Type | Description |
284
- | :------------: | :---------: | :------------------------------------------------------------------------------------------------------------------------------- |
285
- | **`true`** | `{Boolean}` | Enables local scoped CSS by default (use **local** mode by default) |
286
- | **`false`** | `{Boolean}` | Disable the **CSS Modules** spec, all **CSS Modules** features (like `@value`, `:local`, `:global` and `composes`) will not work |
287
- | **`'local'`** | `{String}` | Enables local scoped CSS by default (same as `true` value) |
288
- | **`'global'`** | `{String}` | Enables global scoped CSS by default |
292
+ The `modules` option enables/disables the **[CSS Modules](https://github.com/css-modules/css-modules)** specification and setup basic behaviour.
289
293
 
290
294
  Using `false` value increase performance because we avoid parsing **CSS Modules** features, it will be useful for developers who use vanilla css or use other technologies.
291
295
 
292
- You can read about **modes** below.
293
-
294
296
  **webpack.config.js**
295
297
 
296
298
  ```js
@@ -298,7 +300,7 @@ module.exports = {
298
300
  module: {
299
301
  rules: [
300
302
  {
301
- test: /\.css$/,
303
+ test: /\.css$/i,
302
304
  loader: 'css-loader',
303
305
  options: {
304
306
  modules: true,
@@ -309,6 +311,8 @@ module.exports = {
309
311
  };
310
312
  ```
311
313
 
314
+ #### `Features`
315
+
312
316
  ##### `Scope`
313
317
 
314
318
  Using `local` value requires you to specify `:global` classes.
@@ -321,7 +325,7 @@ Styles can be locally scoped to avoid globally scoping styles.
321
325
  The syntax `:local(.className)` can be used to declare `className` in the local scope. The local identifiers are exported by the module.
322
326
 
323
327
  With `:local` (without brackets) local mode can be switched on for this selector.
324
- The `:global(.className)` nocation can be used to declare an explicit global selector.
328
+ The `:global(.className)` notation can be used to declare an explicit global selector.
325
329
  With `:global` (without brackets) global mode can be switched on for this selector.
326
330
 
327
331
  The loader replaces local selectors with unique identifiers. The chosen unique identifiers are exported by the module.
@@ -434,13 +438,36 @@ To import from multiple modules use multiple `composes:` rules.
434
438
  }
435
439
  ```
436
440
 
437
- ### `localIdentName`
441
+ ##### `Values`
438
442
 
439
- Type: `String`
440
- Default: `[hash:base64]`
443
+ You can use `@value` to specific values to be reused throughout a document.
441
444
 
442
- You can configure the generated ident with the `localIdentName` query parameter.
443
- See [loader-utils's documentation](https://github.com/webpack/loader-utils#interpolatename) for more information on options.
445
+ We recommend use prefix `v-` for values, `s-` for selectors and `m-` for media at-rules.
446
+
447
+ ```css
448
+ @value v-primary: #BF4040;
449
+ @value s-black: black-selector;
450
+ @value m-large: (min-width: 960px);
451
+
452
+ .header {
453
+ color: v-primary;
454
+ padding: 0 10px;
455
+ }
456
+
457
+ .s-black {
458
+ color: black;
459
+ }
460
+
461
+ @media m-large {
462
+ .header {
463
+ padding: 0 20px;
464
+ }
465
+ }
466
+ ```
467
+
468
+ #### `Boolean`
469
+
470
+ Enable **CSS Modules** features.
444
471
 
445
472
  **webpack.config.js**
446
473
 
@@ -449,11 +476,10 @@ module.exports = {
449
476
  module: {
450
477
  rules: [
451
478
  {
452
- test: /\.css$/,
479
+ test: /\.css$/i,
453
480
  loader: 'css-loader',
454
481
  options: {
455
482
  modules: true,
456
- localIdentName: '[path][name]__[local]--[hash:base64:5]',
457
483
  },
458
484
  },
459
485
  ],
@@ -461,7 +487,9 @@ module.exports = {
461
487
  };
462
488
  ```
463
489
 
464
- You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema.
490
+ #### `String`
491
+
492
+ Enable **CSS Modules** features and setup `mode`.
465
493
 
466
494
  **webpack.config.js**
467
495
 
@@ -470,15 +498,37 @@ module.exports = {
470
498
  module: {
471
499
  rules: [
472
500
  {
473
- test: /\.css$/,
501
+ test: /\.css$/i,
474
502
  loader: 'css-loader',
475
503
  options: {
476
- modules: true,
477
- context: path.resolve(__dirname, 'context'), // Allow to redefine basic loader context for `local-ident-name`
478
- hashPrefix: 'hash', // Allow to add custom hash to generate more unique classes
479
- localIdentName: '[path][name]__[local]--[hash:base64:5]',
480
- getLocalIdent: (context, localIdentName, localName, options) => {
481
- return 'whatever_random_class_name';
504
+ // Using `local` value has same effect like using `modules: true`
505
+ modules: 'global',
506
+ },
507
+ },
508
+ ],
509
+ },
510
+ };
511
+ ```
512
+
513
+ #### `Object`
514
+
515
+ Enable **CSS Modules** features and setup options for them.
516
+
517
+ **webpack.config.js**
518
+
519
+ ```js
520
+ module.exports = {
521
+ module: {
522
+ rules: [
523
+ {
524
+ test: /\.css$/i,
525
+ loader: 'css-loader',
526
+ options: {
527
+ modules: {
528
+ mode: 'local',
529
+ localIdentName: '[path][name]__[local]--[hash:base64:5]',
530
+ context: path.resolve(__dirname, 'src'),
531
+ hashPrefix: 'my-custom-hash',
482
532
  },
483
533
  },
484
534
  },
@@ -487,16 +537,49 @@ module.exports = {
487
537
  };
488
538
  ```
489
539
 
490
- ### `sourceMap`
540
+ ##### `mode`
491
541
 
492
- Type: `Boolean`
493
- Default: `true`
542
+ Type: `String`
543
+ Default: `local`
494
544
 
495
- To include source maps set the `sourceMap` option.
545
+ Setup `mode` option. You can omit the value when you want `local` mode.
496
546
 
497
- I.e. the `mini-css-extract-plugin` can handle them.
547
+ **webpack.config.js**
498
548
 
499
- 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 includes the server URL.
549
+ ```js
550
+ module.exports = {
551
+ module: {
552
+ rules: [
553
+ {
554
+ test: /\.css$/i,
555
+ loader: 'css-loader',
556
+ options: {
557
+ modules: {
558
+ mode: 'global',
559
+ },
560
+ },
561
+ },
562
+ ],
563
+ },
564
+ };
565
+ ```
566
+
567
+ ##### `localIdentName`
568
+
569
+ Type: `String`
570
+ Default: `[hash:base64]`
571
+
572
+ You can configure the generated ident with the `localIdentName` query parameter.
573
+ See [loader-utils's documentation](https://github.com/webpack/loader-utils#interpolatename) for more information on options.
574
+
575
+ Recommendations:
576
+
577
+ - use `[path][name]__[local]` for development
578
+ - use `[hash:base64]` for production
579
+
580
+ The `[local]` placeholder contains original class.
581
+
582
+ **Note:** all reserved (`<>:"/\|?*`) and control filesystem characters (excluding characters in the `[local]` placeholder) will be converted to `-`.
500
583
 
501
584
  **webpack.config.js**
502
585
 
@@ -505,10 +588,12 @@ module.exports = {
505
588
  module: {
506
589
  rules: [
507
590
  {
508
- test: /\.css$/,
591
+ test: /\.css$/i,
509
592
  loader: 'css-loader',
510
593
  options: {
511
- sourceMap: true,
594
+ modules: {
595
+ localIdentName: '[path][name]__[local]--[hash:base64:5]',
596
+ },
512
597
  },
513
598
  },
514
599
  ],
@@ -516,34 +601,127 @@ module.exports = {
516
601
  };
517
602
  ```
518
603
 
519
- ### `camelCase`
604
+ ##### `context`
520
605
 
521
- Type: `Boolean|String`
522
- Default: `false`
606
+ Type: `String`
607
+ Default: `undefined`
523
608
 
524
- By default, the exported JSON keys mirror the class names. If you want to camelize class names (useful in JS), pass the query parameter `camelCase` to css-loader.
609
+ Allow to redefine basic loader context for local ident name.
610
+ By default we use `rootContext` of loader.
525
611
 
526
- | Name | Type | Description |
527
- | :----------------: | :---------: | :----------------------------------------------------------------------------------------------------------------------- |
528
- | **`false`** | `{Boolean}` | Class names will be camelized, the original class name will not to be removed from the locals |
529
- | **`true`** | `{Boolean}` | Class names will be camelized |
530
- | **`'dashes'`** | `{String}` | Only dashes in class names will be camelized |
531
- | **`'only'`** | `{String}` | Introduced in `0.27.1`. Class names will be camelized, the original class name will be removed from the locals |
532
- | **`'dashesOnly'`** | `{String}` | Introduced in `0.27.1`. Dashes in class names will be camelized, the original class name will be removed from the locals |
612
+ **webpack.config.js**
533
613
 
534
- **file.css**
614
+ ```js
615
+ module.exports = {
616
+ module: {
617
+ rules: [
618
+ {
619
+ test: /\.css$/i,
620
+ loader: 'css-loader',
621
+ options: {
622
+ modules: {
623
+ context: path.resolve(__dirname, 'context'),
624
+ },
625
+ },
626
+ },
627
+ ],
628
+ },
629
+ };
630
+ ```
535
631
 
536
- ```css
537
- .class-name {
538
- }
632
+ ##### `hashPrefix`
633
+
634
+ Type: `String`
635
+ Default: `undefined`
636
+
637
+ Allow to add custom hash to generate more unique classes.
638
+
639
+ **webpack.config.js**
640
+
641
+ ```js
642
+ module.exports = {
643
+ module: {
644
+ rules: [
645
+ {
646
+ test: /\.css$/i,
647
+ loader: 'css-loader',
648
+ options: {
649
+ modules: {
650
+ hashPrefix: 'hash',
651
+ },
652
+ },
653
+ },
654
+ ],
655
+ },
656
+ };
539
657
  ```
540
658
 
541
- **file.js**
659
+ ##### `getLocalIdent`
660
+
661
+ Type: `Function`
662
+ Default: `undefined`
663
+
664
+ You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema.
665
+ By default we use built-in function to generate a classname.
666
+
667
+ **webpack.config.js**
542
668
 
543
669
  ```js
544
- import { className } from 'file.css';
670
+ module.exports = {
671
+ module: {
672
+ rules: [
673
+ {
674
+ test: /\.css$/i,
675
+ loader: 'css-loader',
676
+ options: {
677
+ modules: {
678
+ getLocalIdent: (context, localIdentName, localName, options) => {
679
+ return 'whatever_random_class_name';
680
+ },
681
+ },
682
+ },
683
+ },
684
+ ],
685
+ },
686
+ };
687
+ ```
688
+
689
+ ##### `localIdentRegExp`
690
+
691
+ Type: `String|RegExp`
692
+ Default: `undefined`
693
+
694
+ **webpack.config.js**
695
+
696
+ ```js
697
+ module.exports = {
698
+ module: {
699
+ rules: [
700
+ {
701
+ test: /\.css$/i,
702
+ loader: 'css-loader',
703
+ options: {
704
+ modules: {
705
+ localIdentRegExp: /page-(.*)\.css/i,
706
+ },
707
+ },
708
+ },
709
+ ],
710
+ },
711
+ };
545
712
  ```
546
713
 
714
+ ### `sourceMap`
715
+
716
+ Type: `Boolean`
717
+ Default: `false`
718
+
719
+ Enables/Disables generation of source maps.
720
+
721
+ To include source maps set the `sourceMap` option.
722
+
723
+ They are not enabled by default because they expose a runtime overhead and increase in bundle size (JS source maps do not).
724
+
547
725
  **webpack.config.js**
548
726
 
549
727
  ```js
@@ -551,10 +729,10 @@ module.exports = {
551
729
  module: {
552
730
  rules: [
553
731
  {
554
- test: /\.css$/,
732
+ test: /\.css$/i,
555
733
  loader: 'css-loader',
556
734
  options: {
557
- camelCase: true,
735
+ sourceMap: true,
558
736
  },
559
737
  },
560
738
  ],
@@ -567,6 +745,8 @@ module.exports = {
567
745
  Type: `Number`
568
746
  Default: `0`
569
747
 
748
+ Enables/Disables or setups number of loaders applied before CSS loader.
749
+
570
750
  The option `importLoaders` allows you to configure how many loaders before `css-loader` should be applied to `@import`ed resources.
571
751
 
572
752
  **webpack.config.js**
@@ -576,13 +756,16 @@ module.exports = {
576
756
  module: {
577
757
  rules: [
578
758
  {
579
- test: /\.css$/,
759
+ test: /\.css$/i,
580
760
  use: [
581
761
  'style-loader',
582
762
  {
583
763
  loader: 'css-loader',
584
764
  options: {
585
- importLoaders: 2, // 0 => no loaders (default); 1 => postcss-loader; 2 => postcss-loader, sass-loader
765
+ importLoaders: 2,
766
+ // 0 => no loaders (default);
767
+ // 1 => postcss-loader;
768
+ // 2 => postcss-loader, sass-loader
586
769
  },
587
770
  },
588
771
  'postcss-loader',
@@ -596,12 +779,62 @@ module.exports = {
596
779
 
597
780
  This may change in the future when the module system (i. e. webpack) supports loader matching by origin.
598
781
 
599
- ### `exportOnlyLocals`
782
+ ### `localsConvention`
783
+
784
+ Type: `String`
785
+ Default: `undefined`
786
+
787
+ Style of exported classnames.
788
+
789
+ By default, the exported JSON keys mirror the class names (i.e `asIs` value).
790
+
791
+ | Name | Type | Description |
792
+ | :-------------------: | :--------: | :----------------------------------------------------------------------------------------------- |
793
+ | **`'asIs'`** | `{String}` | Class names will be exported as is. |
794
+ | **`'camelCase'`** | `{String}` | Class names will be camelized, the original class name will not to be removed from the locals |
795
+ | **`'camelCaseOnly'`** | `{String}` | Class names will be camelized, the original class name will be removed from the locals |
796
+ | **`'dashes'`** | `{String}` | Only dashes in class names will be camelized |
797
+ | **`'dashesOnly'`** | `{String}` | Dashes in class names will be camelized, the original class name will be removed from the locals |
798
+
799
+ **file.css**
800
+
801
+ ```css
802
+ .class-name {
803
+ }
804
+ ```
805
+
806
+ **file.js**
807
+
808
+ ```js
809
+ import { className } from 'file.css';
810
+ ```
811
+
812
+ **webpack.config.js**
813
+
814
+ ```js
815
+ module.exports = {
816
+ module: {
817
+ rules: [
818
+ {
819
+ test: /\.css$/i,
820
+ loader: 'css-loader',
821
+ options: {
822
+ localsConvention: 'camelCase',
823
+ },
824
+ },
825
+ ],
826
+ },
827
+ };
828
+ ```
829
+
830
+ ### `onlyLocals`
600
831
 
601
832
  Type: `Boolean`
602
833
  Default: `false`
603
834
 
604
- Export only locals (**useful** when you use **css modules**).
835
+ Export only locals.
836
+
837
+ **Useful** when you use **css modules** for pre-rendering (for example SSR).
605
838
  For pre-rendering with `mini-css-extract-plugin` you should use this option instead of `style-loader!css-loader` **in the pre-rendering bundle**.
606
839
  It doesn't embed CSS but only exports the identifier mappings.
607
840
 
@@ -612,10 +845,10 @@ module.exports = {
612
845
  module: {
613
846
  rules: [
614
847
  {
615
- test: /\.css$/,
848
+ test: /\.css$/i,
616
849
  loader: 'css-loader',
617
850
  options: {
618
- exportOnlyLocals: true,
851
+ onlyLocals: true,
619
852
  },
620
853
  },
621
854
  ],
@@ -636,14 +869,14 @@ module.exports = {
636
869
  module: {
637
870
  rules: [
638
871
  {
639
- test: /\.css$/,
872
+ test: /\.css$/i,
640
873
  use: ['style-loader', 'css-loader'],
641
874
  },
642
875
  {
643
- test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
876
+ test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
644
877
  loader: 'url-loader',
645
878
  options: {
646
- limit: 10000,
879
+ limit: 8192,
647
880
  },
648
881
  },
649
882
  ],
@@ -654,10 +887,52 @@ module.exports = {
654
887
  ### Extract
655
888
 
656
889
  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.
657
- - This can be achieved by using the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to extract the CSS when running in production mode.
890
+
891
+ - This can be achieved by using the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to extract the CSS when running in production mode.
658
892
 
659
893
  - As an alternative, if seeking better development performance and css outputs that mimic production. [extract-css-chunks-webpack-plugin](https://github.com/faceyspacey/extract-css-chunks-webpack-plugin) offers a hot module reload friendly, extended version of mini-css-extract-plugin. HMR real CSS files in dev, works like mini-css in non-dev
660
894
 
895
+ ### CSS modules and pure CSS
896
+
897
+ When you have pure CSS (without CSS modules) and CSS modules in project you can use this setup:
898
+
899
+ **webpack.config.js**
900
+
901
+ ```js
902
+ module.exports = {
903
+ module: {
904
+ rules: [
905
+ {
906
+ // For pure CSS (without CSS modules)
907
+ test: /\.css$/i,
908
+ exclude: /\.module\.css$/i,
909
+ use: ['style-loader', 'css-loader'],
910
+ },
911
+ {
912
+ // For CSS modules
913
+ test: /\.module\.css$/i,
914
+ use: [
915
+ 'style-loader',
916
+ {
917
+ loader: 'css-loader',
918
+ options: {
919
+ modules: true,
920
+ },
921
+ },
922
+ ],
923
+ },
924
+ {
925
+ test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
926
+ loader: 'url-loader',
927
+ options: {
928
+ limit: 8192,
929
+ },
930
+ },
931
+ ],
932
+ },
933
+ };
934
+ ```
935
+
661
936
  ## Contributing
662
937
 
663
938
  Please take a moment to read our contributing guidelines if you haven't yet done so.
@@ -670,21 +945,15 @@ Please take a moment to read our contributing guidelines if you haven't yet done
670
945
 
671
946
  [npm]: https://img.shields.io/npm/v/css-loader.svg
672
947
  [npm-url]: https://npmjs.com/package/css-loader
673
-
674
948
  [node]: https://img.shields.io/node/v/css-loader.svg
675
949
  [node-url]: https://nodejs.org
676
-
677
950
  [deps]: https://david-dm.org/webpack-contrib/css-loader.svg
678
951
  [deps-url]: https://david-dm.org/webpack-contrib/css-loader
679
-
680
- [tests]: https://img.shields.io/circleci/project/github/webpack-contrib/css-loader.svg
681
- [tests-url]: https://circleci.com/gh/webpack-contrib/css-loader
682
-
952
+ [tests]: https://dev.azure.com/webpack-contrib/css-loader/_apis/build/status/webpack-contrib.css-loader?branchName=master
953
+ [tests-url]: https://dev.azure.com/webpack-contrib/css-loader/_build/latest?definitionId=2&branchName=master
683
954
  [cover]: https://codecov.io/gh/webpack-contrib/css-loader/branch/master/graph/badge.svg
684
955
  [cover-url]: https://codecov.io/gh/webpack-contrib/css-loader
685
-
686
956
  [chat]: https://badges.gitter.im/webpack/webpack.svg
687
957
  [chat-url]: https://gitter.im/webpack/webpack
688
-
689
958
  [size]: https://packagephobia.now.sh/badge?p=css-loader
690
959
  [size-url]: https://packagephobia.now.sh/result?p=css-loader