Skip to content

Commit b65ea22

Browse files
committed
add support for clean-css v3.x. fixes #12
1 parent 38e3056 commit b65ea22

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

css.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,21 @@ define([
204204
});
205205

206206
if (CleanCSS) {
207-
var result = "";
207+
var layer = "";
208208
loadList.forEach(function (src) {
209-
result += new CleanCSS({
209+
var result = new CleanCSS({
210210
relativeTo: "./",
211211
target: dest
212212
}).minify("@import url(" + src + ");");
213+
// Support clean-css version 2.x and 3.x
214+
layer += result.styles || result;
213215
});
214216

215-
writePluginFiles(dest, result);
217+
writePluginFiles(dest, layer);
216218
return true;
217219
} else {
218-
console.log(">> Node module clean-css not found. Skipping CSS inlining. If you want CSS inlining" +
219-
" run 'npm install clean-css' in your console.");
220+
console.log(">> WARNING: Node module clean-css not found. Skipping CSS inlining. If you" +
221+
" want CSS inlining run 'npm install clean-css' in your console.");
220222
loadList.forEach(function (src) {
221223
writePluginFiles(src, fs.readFileSync(src));
222224
});

0 commit comments

Comments
 (0)