From 5b50db6adb0f93f13a47d049e18877af7b66061a Mon Sep 17 00:00:00 2001 From: loop0 Date: Wed, 9 May 2018 11:55:05 +0200 Subject: [PATCH] Spaces before not,and,or are removed Adding support for cases: - @supports not ( - @supports not (not ( - @supports (display: grid) and (not ( https://developer.mozilla.org/en-US/docs/Web/CSS/%40supports --- uglifycss-lib.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/uglifycss-lib.js b/uglifycss-lib.js index 19d686e..7d201c2 100644 --- a/uglifycss-lib.js +++ b/uglifycss-lib.js @@ -600,6 +600,11 @@ function processString(content = '', options = defaultOptions) { // remove spaces before the things that should not have spaces before them. content = content.replace(/\s+([!{};:>+\(\)\],])/g, '$1') + //add removed spaces for `not(`, `and(`, `or(` + content = content.replace(/\s+not\(/g, ' not ('); + content = content.replace(/and\(/g, 'and ('); + content = content.replace(/or\(/g, 'or ('); + // restore spaces for !important content = content.replace(/!important/g, ' !important')