File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 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.
6666
6767I. e. the extract-text-webpack-plugin can handle them.
6868
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+
6987### Minification
7088
7189By 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) {
1313 var query = loaderUtils . parseQuery ( this . query ) ;
1414 var root = query . root ;
1515 var forceMinimize = query . minimize ;
16+ var importLoaders = parseInt ( query . importLoaders , 10 ) || 0 ;
1617 var minimize = typeof forceMinimize !== "undefined" ? ! ! forceMinimize : ( this && this . minimize ) ;
1718 var tree = csso . parse ( content , "stylesheet" ) ;
1819 if ( tree && minimize ) {
@@ -29,7 +30,10 @@ module.exports = function(content) {
2930 result . push ( "exports.push([module.id, " + JSON . stringify ( "@import url(" + imp . url + ");" ) + ", " + JSON . stringify ( imp . media . join ( "" ) ) + "]);" ) ;
3031 } else {
3132 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 ( "!" ) + "!" +
3337 loaderUtils . urlToRequest ( imp . url ) ;
3438 result . push ( "require(" + JSON . stringify ( require . resolve ( "./mergeImport" ) ) + ")(exports, require(" + JSON . stringify ( importUrl ) + "), " + JSON . stringify ( imp . media . join ( "" ) ) + ");" ) ;
3539 }
You can’t perform that action at this time.
0 commit comments