Skip to content

Commit ed97c2b

Browse files
committed
Hacky classnames map
1 parent 015ceb5 commit ed97c2b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/loader.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var compileExports = require("./compile-exports");
1212

1313
module.exports = function(content, map) {
1414
if(this.cacheable) this.cacheable();
15+
var that = this;
1516
var callback = this.async();
1617
var loaderOptions = loaderUtils.parseQuery(this.query);
1718
var configKey = loaderOptions.config || "cssLoader";
@@ -21,6 +22,12 @@ module.exports = function(content, map) {
2122
var moduleMode = query.modules || query.module;
2223
var camelCaseKeys = query.camelCase || query.camelcase;
2324

25+
if (!this._compilation.cssLoader) {
26+
this._compilation.cssLoader = {
27+
classnames: []
28+
};
29+
}
30+
2431
if(map !== null && typeof map !== "string") {
2532
map = JSON.stringify(map);
2633
}
@@ -32,9 +39,16 @@ module.exports = function(content, map) {
3239
query: query,
3340
minimize: this.minimize,
3441
loaderContext: this
35-
}, function(err, result) {
42+
},
43+
44+
function(err, result) {
3645
if(err) return callback(err);
3746

47+
that._compilation.cssLoader.classnames.push({
48+
file: result.map.file,
49+
exports: result.exports
50+
});
51+
3852
var cssAsString = JSON.stringify(result.source);
3953

4054
// for importing CSS

0 commit comments

Comments
 (0)