diff --git a/src/printer-postcss.js b/src/printer-postcss.js index ffb712db9..a83474c08 100644 --- a/src/printer-postcss.js +++ b/src/printer-postcss.js @@ -81,7 +81,7 @@ function genericPrint(path, options, print) { return concat([ n.raws.before.replace(/[\s;]/g, ""), - n.prop.startsWith("--") ? n.prop : maybeToLowerCase(n.prop), + maybeToLowerCase(n.prop), ":", isValueExtend ? "" : " ", isComposed @@ -482,7 +482,10 @@ function printNumber(rawNumber) { } function maybeToLowerCase(value) { - return value.includes("$") || value.includes("@") || value.includes("#") + return value.includes("$") || + value.includes("@") || + value.includes("#") || + value.startsWith("--") ? value : value.toLowerCase(); } diff --git a/tests/css_case/__snapshots__/jsfmt.spec.js.snap b/tests/css_case/__snapshots__/jsfmt.spec.js.snap index 5c8f6267a..92673f290 100644 --- a/tests/css_case/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_case/__snapshots__/jsfmt.spec.js.snap @@ -35,6 +35,9 @@ a[HREF=KeepAttrValue]:HOVER::FIRST-letter, } } +@custom-media --KeepCustomMedia screen and (width >= 768px); +@media (--KeepCustomMedia) {} + @KeepDetachedRuleset: /*:*/ { BACKGROUND: RED; } @@ -104,6 +107,10 @@ a[href="KeepAttrValue"]:hover::first-letter, } } +@custom-media --KeepCustomMedia screen and (width >= 768px); +@media (--KeepCustomMedia) { +} + @KeepDetachedRuleset: { background: RED; } @@ -184,6 +191,9 @@ a[HREF=KeepAttrValue]:HOVER::FIRST-letter, } } +@custom-media --KeepCustomMedia screen and (width >= 768px); +@media (--KeepCustomMedia) {} + @FUNCTION KeepFuncName() { @RETURN 12; } @@ -256,6 +266,10 @@ a[href="KeepAttrValue"]:hover::first-letter, } } +@custom-media --KeepCustomMedia screen and (width >= 768px); +@media (--KeepCustomMedia) { +} + @function KeepFuncName() { @return 12; } diff --git a/tests/css_case/case.less b/tests/css_case/case.less index 41ab76ff0..9d8fe85a7 100644 --- a/tests/css_case/case.less +++ b/tests/css_case/case.less @@ -32,6 +32,9 @@ a[HREF=KeepAttrValue]:HOVER::FIRST-letter, } } +@custom-media --KeepCustomMedia screen and (width >= 768px); +@media (--KeepCustomMedia) {} + @KeepDetachedRuleset: /*:*/ { BACKGROUND: RED; } diff --git a/tests/css_case/case.scss b/tests/css_case/case.scss index 8e7c4651d..f57543824 100644 --- a/tests/css_case/case.scss +++ b/tests/css_case/case.scss @@ -33,6 +33,9 @@ a[HREF=KeepAttrValue]:HOVER::FIRST-letter, } } +@custom-media --KeepCustomMedia screen and (width >= 768px); +@media (--KeepCustomMedia) {} + @FUNCTION KeepFuncName() { @RETURN 12; }