File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ module.exports = function (content) {
213
213
}
214
214
}
215
215
216
- var loader = options . extractCSS
216
+ var loader = options . extractCSS && type === 'styles'
217
217
? loaders [ lang ] || getCSSExtractLoader ( lang )
218
218
: loaders [ lang ]
219
219
Original file line number Diff line number Diff line change @@ -166,6 +166,32 @@ describe('vue-loader', function () {
166
166
} )
167
167
} )
168
168
169
+ it ( 'pre-processors with extract css' , done => {
170
+ test ( {
171
+ entry : './test/fixtures/pre.vue' ,
172
+ vue : {
173
+ extractCSS : true
174
+ } ,
175
+ plugins : [
176
+ new ExtractTextPlugin ( 'test.output.css' )
177
+ ]
178
+ } , ( window , module ) => {
179
+ var vnode = mockRender ( module )
180
+
181
+ expect ( vnode . children [ 0 ] . tag ) . to . equal ( 'h1' )
182
+ expect ( vnode . children [ 1 ] . tag ) . to . equal ( 'comp-a' )
183
+ expect ( vnode . children [ 2 ] . tag ) . to . equal ( 'comp-b' )
184
+
185
+ expect ( module . data ( ) . msg ) . to . contain ( 'Hello from coffee!' )
186
+
187
+ var css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
188
+ css = normalizeNewline ( css )
189
+ expect ( css ) . to . contain ( 'body {\n font: 100% Helvetica, sans-serif;\n color: #999;\n}' )
190
+
191
+ done ( )
192
+ } )
193
+ } )
194
+
169
195
it ( 'scoped style' , done => {
170
196
test ( {
171
197
entry : './test/fixtures/scoped-css.vue' ,
You can’t perform that action at this time.
0 commit comments