File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,24 @@ To include SourceMaps set the `sourceMap` query param.
66
66
67
67
I. e. the extract-text-webpack-plugin can handle them.
68
68
69
+ ### importing and chained loaders
70
+
71
+ The query parameter ` importLoaders ` allow to configure which loaders should be applied to ` @import ` ed resources.
72
+
73
+ ` importLoaders ` (int): That many loaders after the css-loader are used to import resources.
74
+
75
+ Examples:
76
+
77
+ ``` js
78
+ require (" style-loader!css-loader?importLoaders=1!autoprefixer-loader!..." )
79
+ // => imported resources are handled this way:
80
+ require (" css-loader?importLoaders=1!autoprefixer-loader!..." )
81
+
82
+ require (" style-loader!css-loader!stylus-loader!..." )
83
+ // => imported resources are handled this way:
84
+ require (" css-loader!..." )
85
+ ```
86
+
69
87
### Minification
70
88
71
89
By default the css-loader minimizes the css if specified by the module system.
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module.exports = function(content) {
13
13
var query = loaderUtils . parseQuery ( this . query ) ;
14
14
var root = query . root ;
15
15
var forceMinimize = query . minimize ;
16
+ var importLoaders = parseInt ( query . importLoaders , 10 ) || 0 ;
16
17
var minimize = typeof forceMinimize !== "undefined" ? ! ! forceMinimize : ( this && this . minimize ) ;
17
18
var tree = csso . parse ( content , "stylesheet" ) ;
18
19
if ( tree && minimize ) {
@@ -29,7 +30,10 @@ module.exports = function(content) {
29
30
result . push ( "exports.push([module.id, " + JSON . stringify ( "@import url(" + imp . url + ");" ) + ", " + JSON . stringify ( imp . media . join ( "" ) ) + "]);" ) ;
30
31
} else {
31
32
var importUrl = "-!" +
32
- this . loaders . slice ( this . loaderIndex ) . map ( function ( x ) { return x . request ; } ) . join ( "!" ) + "!" +
33
+ this . loaders . slice (
34
+ this . loaderIndex ,
35
+ this . loaderIndex + 1 + importLoaders
36
+ ) . map ( function ( x ) { return x . request ; } ) . join ( "!" ) + "!" +
33
37
loaderUtils . urlToRequest ( imp . url ) ;
34
38
result . push ( "require(" + JSON . stringify ( require . resolve ( "./mergeImport" ) ) + ")(exports, require(" + JSON . stringify ( importUrl ) + "), " + JSON . stringify ( imp . media . join ( "" ) ) + ");" ) ;
35
39
}
You can’t perform that action at this time.
0 commit comments