Skip to content

Latest commit

 

History

History
114 lines (76 loc) · 1.72 KB

README.md

File metadata and controls

114 lines (76 loc) · 1.72 KB

string-quotes

Specify single or double quotes around strings.

a[id="foo"] { content: "x"; }
/**  ↑   ↑             ↑ ↑
 * These quotes and these quotes */

Quotes within comments are ignored.

/* "This is fine" */
/* 'And this is also fine' */

Single quotes in a charset @-rule are ignored as using single quotes in this context is incorrect according the CSS specification.

@charset "utf-8"
/* fine regardless of configuration */

命令行中的 --fix 选项可以自动修复此规则报告的大多数问题。

选项

string: "single"|"double"

"single"

Strings must always be wrapped with single quotes.

以下模式被视为违规:

a { content: "x"; }
a[id="foo"] {}

以下模式被视为违规:

a { content: 'x'; }
a[id='foo'] {}
a { content: "x'y'z"; }

"double"

Strings must always be wrapped with double quotes.

以下模式被视为违规:

a { content: 'x'; }
a[id='foo'] {}

以下模式被视为违规:

a { content: "x"; }
a[id="foo"] {}
a { content: 'x"y"z'; }

可选的辅助选项

avoidEscape: true|false, defaults to true

Allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise.

例如,使用 "single", { "avoidEscape" : false }

以下模式被视为违规:

a { content: "x'y'z"; }
a[id="foo'bar'baz"] {}

以下模式被视为违规:

a { content: 'x'; }
a[id='foo'] {}