Skip to main content

function-url-quotes

需要或禁止 URL 引号。

¥Require or disallow quotes for urls.

a { background: url("x.jpg") }
/** ↑ ↑

* These quotes */

fix 选项 可以自动修复此规则报告的大部分问题。

¥The fix option can automatically fix most of the problems reported by this rule.

选项

¥Options

"always"

URL 必须始终加引号。

¥Urls must always be quoted.

{
"function-url-quotes": "always"
}

以下模式被视为问题:

¥The following patterns are considered problems:

@import url(foo.css);
@font-face { font-family: 'foo'; src: url(foo.ttf); }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { background: url('x.jpg'); }
@import url("foo.css");
@font-face { font-family: "foo"; src: url("foo.ttf"); }

"never"

绝对不能引用 URL。

¥Urls must never be quoted.

{
"function-url-quotes": "never"
}

以下模式被视为问题:

¥The following patterns are considered problems:

a { background: url('x.jpg'); }
@import url("foo.css");
@font-face { font-family: "foo"; src: url('foo.ttf'); }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { background: url(x.jpg); }
@import url(foo.css);
@font-face { font-family: 'foo'; src: url(foo.ttf); }

可选的辅助选项

¥Optional secondary options

except

{ "except": ["array", "of", "options"] }

"empty"

反转没有参数的函数的主要选项。

¥Reverse the primary option for functions that have no arguments.

鉴于:

¥Given:

{
"function-url-quotes": ["always", { "except": ["empty"] }]
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

@-moz-document url-prefix() {}