File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -106,12 +106,25 @@ module.exports = function (content) {
106
106
} )
107
107
}
108
108
109
+ // stringify an Array of loader objects
110
+ function stringifyLoaders ( loaders ) {
111
+ return loaders . map ( function ( obj ) {
112
+ return obj && typeof obj === 'object' && typeof obj . loader === 'string'
113
+ ? obj . loader + ( obj . options ? '?' + JSON . stringify ( obj . options ) : '' )
114
+ : obj
115
+ } ) . join ( '!' )
116
+ }
117
+
109
118
function getLoaderString ( type , part , index , scoped ) {
110
119
var lang = part . lang || defaultLang [ type ]
111
120
var loader = loaders [ lang ]
112
121
var rewriter = getRewriter ( type , scoped )
113
122
var injectString = ( type === 'script' && query . inject ) ? 'inject!' : ''
114
123
if ( loader !== undefined ) {
124
+ if ( Array . isArray ( loader ) ) {
125
+ loader = stringifyLoaders ( loader )
126
+ }
127
+
115
128
if ( type === 'style' ) {
116
129
loader = addCssModulesToLoader ( loader , part , index )
117
130
}
Original file line number Diff line number Diff line change @@ -221,6 +221,27 @@ describe('vue-loader', function () {
221
221
} )
222
222
} )
223
223
224
+ it ( 'extract CSS by extract-text-webpack-plugin 2' , function ( done ) {
225
+ webpack ( Object . assign ( { } , globalConfig , {
226
+ entry : './test/fixtures/extract-css.vue' ,
227
+ vue : {
228
+ loaders : {
229
+ css : [ { loader : ExtractTextPlugin . loader ( { remove : true } ) } , { loader : 'css-loader' } ] ,
230
+ stylus : [ { loader : ExtractTextPlugin . loader ( { remove : true } ) } , { loader : 'css-loader?sourceMap' } , { loader : 'stylus-loader' } ]
231
+ }
232
+ } ,
233
+ plugins : [
234
+ new ExtractTextPlugin ( 'test.output2.css' )
235
+ ]
236
+ } ) , function ( err , stats ) {
237
+ expect ( stats . compilation . errors ) . to . be . empty
238
+ getFile ( 'test.output2.css' , function ( data ) {
239
+ expect ( data ) . to . contain ( 'h1 {\n color: #f00;\n}\n\n\n\n\n\n\nh2 {\n color: green;\n}' )
240
+ done ( )
241
+ } )
242
+ } )
243
+ } )
244
+
224
245
it ( 'dependency injection' , function ( done ) {
225
246
test ( {
226
247
entry : './test/fixtures/inject.js'
You can’t perform that action at this time.
0 commit comments