Fixes #250 - correctly handle JSON data in quotations.
authorJakub Pawlowicz <jakub@goalsmashers.com>
Sat, 1 Mar 2014 09:05:55 +0000 (09:05 +0000)
committerJakub Pawlowicz <jakub@goalsmashers.com>
Sat, 1 Mar 2014 23:32:45 +0000 (23:32 +0000)
It's a quick fix. Proper one comes to master soon.

History.md
lib/clean.js
test/unit-test.js

index a8ebdd7..f63e954 100644 (file)
@@ -4,6 +4,11 @@
 * Adds a better non-adjacent optimizer compatible with the upcoming new property optimizer.
 * Fixed issue [#247](https://github.com/GoalSmashers/clean-css/issues/247) - removes deprecated `selectorsMergeMode` switch.
 
+[2.1.4 / 2014-xx-xx](https://github.com/GoalSmashers/clean-css/compare/v2.1.3...v2.1.4)
+==================
+
+* Fixed issue [#250](https://github.com/GoalSmashers/clean-css/issues/250) - correctly handle JSON data in quotations.
+
 [2.1.3 / 2014-02-26](https://github.com/GoalSmashers/clean-css/compare/v2.1.2...v2.1.3)
 ==================
 
index ed00f51..0f31179 100644 (file)
@@ -144,6 +144,9 @@ var minify = function(data, callback) {
 
   // strip parentheses in animation & font names
   replace(/(animation|animation\-name|font|font\-family):([^;}]+)/g, function(match, propertyName, def) {
+    if (def.indexOf('\'{') === 0)
+      return match;
+
     return propertyName + ':' + def.replace(/['"]([a-zA-Z][a-zA-Z\d\-_]+)['"]/g, '$1');
   });
 
index 473a303..aa88284 100644 (file)
@@ -806,7 +806,8 @@ path)}',
       'a{background:url("/very/long/\
 path")}',
       'a{background:url(/very/long/path)}'
-    ]
+    ],
+    'do not remove quotation from enclosed JSON (weird, I know)': "p{font-family:'{ \"current\" : \"large\", \"all\" : [\"small\", \"medium\", \"large\"], \"position\" : 2 }'}"
   }),
   'urls rewriting - no root or target': cssContext({
     'no @import': 'a{background:url(test/data/partials/extra/down.gif) 0 0 no-repeat}',