Why:
* So it's not about `!important` modifier but `@` sign which were
incorrectly treated as a special marker starting a block.
* The solution is somewhat hacky - checking if a preceding character
is not a special marker - but an improved tokenizer will be there
soon (-ish).
* Requires Node.js 4.0+ to run.
+[3.4.21 / 2016-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.20...3.4)
+==================
+
+* Fixed issue [#833](https://github.com/jakubpawlowicz/clean-css/issues/833) - moving `@media` queries.
+
[3.4.20 / 2016-09-26](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.19...v3.4.20)
==================
var nextBodyStart = chunk.indexOf('{', context.cursor);
var nextBodyEnd = chunk.indexOf('}', context.cursor);
+ if (nextSpecial > -1 && context.cursor > 0 && !/\s|\{|\}|\/|_|,|;/.test(chunk.substring(nextSpecial - 1, nextSpecial))) {
+ nextSpecial = -1;
+ }
+
if (nextEscape > -1 && /\S/.test(chunk.substring(context.cursor, nextEscape)))
nextEscape = -1;
'backward of two with overriding shorthand in between': [
'@media screen{a{font-size:10px}}@media (min-width:1024px){.one{font:13px Helvetica}}@media screen{div{display:block}}',
'@media screen{a{font-size:10px}div{display:block}}@media (min-width:1024px){.one{font:13px Helvetica}}'
+ ],
+ 'with at sign in rule name': [
+ '@media screen{.one{margin-left:-16px}}.two{margin-left:0}.three{width:50%!important}.four{width:25%!important}@media screen{.three\\\@m{width:50%!important}.four\\\@m{width:25%!important}}',
+ '@media screen{.one{margin-left:-16px}}.two{margin-left:0}.three{width:50%!important}.four{width:25%!important}@media screen{.three\\\@m{width:50%!important}.four\\\@m{width:25%!important}}'
]
})
)