diff --git a/src/clean-ast.js b/src/clean-ast.js index 489c76969..eeecf92d4 100644 --- a/src/clean-ast.js +++ b/src/clean-ast.js @@ -102,8 +102,10 @@ function massageAST(ast, parent) { if ( (ast.type === "media-feature" || + ast.type === "media-keyword" || ast.type === "media-type" || ast.type === "media-unknown" || + ast.type === "media-url" || ast.type === "media-value" || ast.type === "selector-root-invalid" || ast.type === "selector-attribute" || diff --git a/src/printer-postcss.js b/src/printer-postcss.js index f2b2d6958..ffb712db9 100644 --- a/src/printer-postcss.js +++ b/src/printer-postcss.js @@ -194,10 +194,10 @@ function genericPrint(path, options, print) { return adjustNumbers(adjustStrings(n.value, options)); } case "media-keyword": { - return n.value; + return adjustStrings(n.value, options); } case "media-url": { - return n.value; + return adjustStrings(n.value, options); } case "media-unknown": { return adjustStrings(n.value, options); diff --git a/tests/css_import/__snapshots__/jsfmt.spec.js.snap b/tests/css_import/__snapshots__/jsfmt.spec.js.snap index 70892396b..a349f9496 100644 --- a/tests/css_import/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_import/__snapshots__/jsfmt.spec.js.snap @@ -40,7 +40,7 @@ exports[`url.css 1`] = ` @import url('foo'); $dir: 'fonts'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -@import url('foo'); +@import url("foo"); $dir: "fonts"; `; diff --git a/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap b/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap index e6149b549..c648791dd 100644 --- a/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap @@ -76,6 +76,13 @@ exports[`quotes.css 1`] = ` } @import "file.css"; +@import 'file.css'; + +@import url("foo.css"); +@import url('foo.css'); + +@import "foo.css" screen and (orientation: landscape); +@import 'foo.css' screen and (orientation: landscape); @foo "one"; @foo 'one'; @@ -162,6 +169,13 @@ one 'two' three {} } @import "file.css"; +@import "file.css"; + +@import url("foo.css"); +@import url("foo.css"); + +@import "foo.css" screen and (orientation: landscape); +@import "foo.css" screen and (orientation: landscape); @foo "one"; @foo "one"; @@ -253,6 +267,13 @@ exports[`quotes.css 2`] = ` } @import "file.css"; +@import 'file.css'; + +@import url("foo.css"); +@import url('foo.css'); + +@import "foo.css" screen and (orientation: landscape); +@import 'foo.css' screen and (orientation: landscape); @foo "one"; @foo 'one'; @@ -339,6 +360,13 @@ one 'two' three {} } @import 'file.css'; +@import 'file.css'; + +@import url('foo.css'); +@import url('foo.css'); + +@import 'foo.css' screen and (orientation: landscape); +@import 'foo.css' screen and (orientation: landscape); @foo 'one'; @foo 'one'; diff --git a/tests/css_quotes/quotes.css b/tests/css_quotes/quotes.css index bef61658c..2313eb12c 100644 --- a/tests/css_quotes/quotes.css +++ b/tests/css_quotes/quotes.css @@ -73,6 +73,13 @@ } @import "file.css"; +@import 'file.css'; + +@import url("foo.css"); +@import url('foo.css'); + +@import "foo.css" screen and (orientation: landscape); +@import 'foo.css' screen and (orientation: landscape); @foo "one"; @foo 'one';