Adjust quotes in some more cases of `@import` in CSS (#2818)

Fixes #2817.
master
Simon Lydell 2017-09-14 14:04:04 +02:00 committed by GitHub
parent 1be06af923
commit 9c598b1846
5 changed files with 40 additions and 3 deletions

View File

@ -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" ||

View File

@ -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);

View File

@ -40,7 +40,7 @@ exports[`url.css 1`] = `
@import url('foo');
$dir: 'fonts';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@import url('foo');
@import url("foo");
$dir: "fonts";
`;

View File

@ -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';

View File

@ -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';