Skip to content

Commit 96afd8e

Browse files
committed
more testing and a few tweaks
1 parent 3b5aa1b commit 96afd8e

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

lib/clean-css-processor.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = function(less) {
1313

1414
if (sourceMap) {
1515
options.sourceMap = sourceMap.getExternalSourceMap();
16+
console.log(options.sourceMap);
1617
}
1718

1819
if (options.keepSpecialComments === undefined) {
@@ -27,16 +28,21 @@ module.exports = function(less) {
2728
var output = new CleanCSS(options).minify(css);
2829

2930
if (sourceMap) {
30-
sourceMap.setExternalSourceMap(output.sourceMap);
31+
sourceMap.setExternalSourceMap(JSON.stringify(output.sourceMap));
3132
}
3233

3334
var css = output.styles;
3435
if (sourceMap) {
3536
var sourceMapURL = sourceMap.getSourceMapURL();
36-
if (sourceMap.isInline()) {
37-
sourceMapURL = "data:application/json;base64," + new Buffer(output.sourceMap).toString('base64');
37+
if (sourceMap.getCSSAppendage) {
38+
css += sourceMap.getCSSAppendage();
39+
} else {
40+
// TODO remove once latest version of less.js (>2.1.0) is released
41+
if (sourceMap.isInline()) {
42+
sourceMapURL = "data:application/json;base64," + new Buffer(output.sourceMap).toString('base64');
43+
}
44+
css += "/*# sourceMappingURL=" + sourceMapURL + " */";
3845
}
39-
css += "/*# sourceMappingURL=" + sourceMapURL + " */";
4046
}
4147

4248
return css;

lib/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ LessPluginCleanCSS.prototype = {
1717
setOptions: function(options) {
1818
this.options = parseOptions(options);
1919
},
20-
minVersion: [2, 0, 0]
20+
//TODO - needs to be higher than this for work with map inline
21+
minVersion: [2, 1, 0]
2122
};
2223

2324
module.exports = LessPluginCleanCSS;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"node": ">=0.4.2"
2828
},
2929
"dependencies": {
30-
"clean-css": "git://github.com/jakubpawlowicz/clean-css.git#ee6b3ca44601d06f83c77c8f2794faf55fe8ae96"
30+
"clean-css": "git://github.com/jakubpawlowicz/clean-css.git#89ae660e04e68517a465426877d9af0264db7f82"
3131
},
3232
"devDependencies": {
3333
},

0 commit comments

Comments
 (0)