Skip to content

Commit a476d42

Browse files
committed
Add source map support
1 parent ec10452 commit a476d42

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ var checkCSS = require('airtight-css-lint');
22
var loaderUtils = require('loader-utils');
33
var assign = require("object-assign");
44

5-
function checkCSSLoader(input, options, webpack, callback) {
5+
function checkCSSLoader(source, options, webpack, map, callback) {
66
var results = [];
77

8-
checkCSS(input, function (line, col, msg) {
8+
checkCSS(source, function (line, col, msg) {
99
results.push([ 'Line ' + line + ':' + col + ' - ' + msg ]);
1010
});
1111

@@ -24,11 +24,11 @@ function checkCSSLoader(input, options, webpack, callback) {
2424
}
2525

2626
if (callback) {
27-
callback(null, input);
27+
callback(null, source, map);
2828
}
2929
}
3030

31-
module.exports = function(input) {
31+
module.exports = function(source, map) {
3232
var options = assign(
3333
{
3434
failTypeError: true, // Use warning if false
@@ -37,16 +37,20 @@ module.exports = function(input) {
3737
loaderUtils.parseQuery(this.query)
3838
);
3939

40+
if (map !== null && typeof map !== "string") {
41+
map = JSON.stringify(map);
42+
}
43+
4044
this.cacheable();
4145
var callback = this.async();
4246

4347
if (!callback) {
44-
checkCSSLoader(input, options, this);
48+
checkCSSLoader(source, options, this, map);
4549

46-
return input;
50+
return source;
4751
} else {
4852
try {
49-
checkCSSLoader(input, options, this, callback);
53+
checkCSSLoader(source, options, this, map, callback);
5054
} catch(e) {
5155
callback(e);
5256
}

0 commit comments

Comments
 (0)