Fixes #652 - order of restoring and removing unused tokens.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 27 Aug 2015 13:13:57 +0000 (14:13 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 27 Aug 2015 15:42:46 +0000 (16:42 +0100)
We should first restore token and then remove unused tokens as this
way the positions don't get mangled.

History.md
lib/selectors/simple.js
test/selectors/simple-test.js

index 5fdd037..32eaa26 100644 (file)
@@ -1,3 +1,8 @@
+[3.4.1 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.0...3.4)
+==================
+
+* Fixed issue [#652](https://github.com/jakubpawlowicz/clean-css/issues/652) - order of restoring and removing tokens.
+
 [3.4.0 / 2015-08-27](https://github.com/jakubpawlowicz/clean-css/compare/v3.3.10...v3.4.0)
 ==================
 
index 3e27e9d..f43f6d2 100644 (file)
@@ -348,8 +348,8 @@ function optimizeBody(properties, options) {
       minifyFont(property);
   }
 
-  removeUnused(_properties);
   restoreFromOptimizing(_properties, true);
+  removeUnused(_properties);
 }
 
 function cleanupCharsets(tokens) {
index ceecce1..41d9b59 100644 (file)
@@ -369,6 +369,10 @@ vows.describe('simple optimizations')
       'bang': [
         'a{color:red !ie}',
         null
+      ],
+      'before content': [
+        'a{*width:101px;color:red!important}',
+        [['color', 'red!important']]
       ]
     })
   )