Skip to content

Commit 257d8c9

Browse files
committed
Merge branch 'extract_loaders_array' of https://github.com/CtrlZvi/extract-text-webpack-plugin into CtrlZvi-extract_loaders_array
2 parents 95c77a1 + 33c5d76 commit 257d8c9

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ ExtractTextPlugin.loader = function(options) {
127127
};
128128

129129
ExtractTextPlugin.extract = function(before, loader, options) {
130-
if(typeof loader === "string") {
130+
if(typeof loader === "string" || Array.isArray(loader)) {
131+
if(typeof before === "string") {
132+
before = before.split("!")
133+
}
131134
return [
132-
ExtractTextPlugin.loader(mergeOptions({omit: before.split("!").length, extract: true, remove: true}, options)),
133-
before,
134-
loader
135-
].join("!");
135+
ExtractTextPlugin.loader(mergeOptions({omit: before.length, extract: true, remove: true}, options))
136+
].concat(before, loader).join("!");
136137
} else {
137138
options = loader;
138139
loader = before;
139140
return [
140141
ExtractTextPlugin.loader(mergeOptions({remove: true}, options)),
141-
loader
142-
].join("!");
142+
].concat(loader).join("!");
143143
}
144144
};
145145

@@ -161,19 +161,19 @@ ExtractTextPlugin.prototype.loader = function(options) {
161161
};
162162

163163
ExtractTextPlugin.prototype.extract = function(before, loader, options) {
164-
if(typeof loader === "string") {
164+
if(typeof loader === "string" || Array.isArray(loader)) {
165+
if(typeof before === "string") {
166+
before = before.split("!")
167+
}
165168
return [
166-
this.loader(mergeOptions({omit: before.split("!").length, extract: true, remove: true}, options)),
167-
before,
168-
loader
169-
].join("!");
169+
ExtractTextPlugin.loader(mergeOptions({omit: before.length, extract: true, remove: true}, options))
170+
].concat(before, loader).join("!");
170171
} else {
171172
options = loader;
172173
loader = before;
173174
return [
174-
this.loader(mergeOptions({remove: true}, options)),
175-
loader
176-
].join("!");
175+
ExtractTextPlugin.loader(mergeOptions({remove: true}, options)),
176+
].concat(loader).join("!");
177177
}
178178
};
179179

0 commit comments

Comments
 (0)