Skip to content

Commit

Permalink
Fixes #410 - handling comments in advanced optimizations.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubpawlowicz committed Dec 19, 2014
1 parent 8b3d306 commit a113462
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.md
@@ -1,6 +1,7 @@
[3.0.1 / 2014-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.0...v3.0.1)
==================

* Fixed issue [#410](https://github.com/GoalSmashers/clean-css/issues/410) - advanced merging and comments.
* Fixed issue [#411](https://github.com/GoalSmashers/clean-css/issues/411) - properties and important comments.

[3.0.0 / 2014-12-18](https://github.com/jakubpawlowicz/clean-css/compare/v2.2.22...v3.0.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/properties/optimizer.js
Expand Up @@ -183,7 +183,7 @@ module.exports = function Optimizer(options, context) {
// e.g. a{display:inline-block;display:-moz-inline-box}
// however if `mergeablePosition` yields true then the rule does not apply
// (e.g merging two adjacent selectors: `a{display:block}a{display:block}`)
if (aggressiveMerging && _property != lastProperty || mergeablePosition(i)) {
if (aggressiveMerging && property !== '' && _property != lastProperty || mergeablePosition(i)) {
while (true) {
toOverridePosition = properties.indexOf(_property, toOverridePosition);
if (toOverridePosition == -1)
Expand Down
4 changes: 4 additions & 0 deletions test/integration-test.js
Expand Up @@ -304,6 +304,10 @@ vows.describe('integration tests').addBatch({
'div{color:red;/*!comment*/display:block}',
'div{color:red;/*!comment*/display:block}'
],
'important between and after values': [
'div{color:red;/*!comment1*/display:block;/*!comment2*/}',
'div{color:red;/*!comment1*/display:block/*!comment2*/}'
],
'two important after value': [
'div{color:red;/*!1*//*!2*/}',
'div{color:red/*!1*//*!2*/}'
Expand Down

0 comments on commit a113462

Please sign in to comment.