* Fixed issue [#543](https://github.com/jakubpawlowicz/clean-css/issues/543) - better "comment in body" handling.
* Fixed issue [#548](https://github.com/jakubpawlowicz/clean-css/issues/548) - regression in font minifying.
+* Fixed issue [#549](https://github.com/jakubpawlowicz/clean-css/issues/549) - special comments in source maps.
[3.2.4 / 2015-04-24](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.3...v3.2.4)
==================
this.specialComments = new EscapeStore('COMMENT_SPECIAL');
this.context = context;
+ this.restored = 0;
this.keepAll = keepSpecialComments == '*';
this.keepOne = keepSpecialComments == '1' || keepSpecialComments === 1;
this.keepBreaks = keepBreaks;
function restore(context, data, from, isSpecial) {
var tempData = [];
- var restored = 0;
var cursor = 0;
var addBreak;
tempData.push(data.substring(cursor, nextMatch.start));
var comment = from.restore(nextMatch.match);
- if (isSpecial && (context.keepAll || (context.keepOne && restored === 0))) {
- restored++;
+ if (isSpecial && (context.keepAll || (context.keepOne && context.restored === 0))) {
+ context.restored++;
addBreak = context.keepBreaks && data[nextMatch.end] != '\n' && data.lastIndexOf('\r\n', nextMatch.end + 1) != nextMatch.end;
tempData.push(comment, addBreak ? lineBreak : '');
} else {
'has right output': function (errors, minified) {
assert.equal(minified.styles, 'div{color:red!important/*!1*//*!2*/}');
}
+ },
+ 'important comments after a property with remove comments': {
+ 'topic': function () {
+ return new CleanCSS({ sourceMap: true, keepSpecialComments: 1 }).minify('div { color: #f00 !important; /*!1*/} /*!2*/ a{/*!3*/}');
+ },
+ 'has right output': function (errors, minified) {
+ assert.equal(minified.styles, 'div{color:red!important/*!1*/}a{}');
+ }
}
})
.addBatch({