Honour escaped @ symbols in classnames and ids
authorLeevi Graham <info@leevigraham.com>
Tue, 10 Jun 2014 08:39:51 +0000 (18:39 +1000)
committerLeevi Graham <info@leevigraham.com>
Wed, 11 Jun 2014 04:53:52 +0000 (14:53 +1000)
Fixes: https://github.com/GoalSmashers/clean-css/issues/292

lib/selectors/tokenizer.js
test/unit-test.js

index 27997ae..d674946 100644 (file)
@@ -1,7 +1,7 @@
 module.exports = function Tokenizer(data, minifyContext) {
   var chunker = new Chunker(data, 128);
   var chunk = chunker.next();
-  var flatBlock = /^@(font\-face|page|\-ms\-viewport|\-o\-viewport|viewport)/;
+  var flatBlock = /(^@(font\-face|page|\-ms\-viewport|\-o\-viewport|viewport)|\\@.+?)/;
 
   var whatsNext = function(context) {
     var cursor = context.cursor;
index 873668d..4e6f6a2 100644 (file)
@@ -1942,5 +1942,7 @@ title']{display:block}",
     '@-ms-viewport': '@-ms-viewport{width:device-width}',
     '@-o-viewport': '@-o-viewport{width:device-width}',
     '@viewport': '@viewport{width:device-width}'
-  })
+  }),
+  'escaped @ symbol in class name': '.pad--all0\\@sm{padding:0}',
+  'escaped @ symbol in id': '#id\\@sm{padding:0}'
 }).export(module);