UNPKG

1.92 kBMarkdownView Raw
1# function-url-quotes
2
3Require or disallow quotes for urls.
4
5<!-- prettier-ignore -->
6```css
7a { background: url("x.jpg") }
8/** ↑ ↑
9 * These quotes */
10```
11
12## Options
13
14`string`: `"always"|"never"`
15
16### `"always"`
17
18Urls _must always_ be quoted.
19
20The following patterns are considered violations:
21
22<!-- prettier-ignore -->
23```css
24@import url(foo.css);
25```
26
27<!-- prettier-ignore -->
28```css
29@document domain(http://www.w3.org/);
30```
31
32<!-- prettier-ignore -->
33```css
34@font-face { font-family: 'foo'; src: url(foo.ttf); }
35```
36
37<!-- prettier-ignore -->
38```css
39@-moz-document url-prefix() {}
40```
41
42The following patterns are _not_ considered violations:
43
44<!-- prettier-ignore -->
45```css
46a { background: url('x.jpg'); }
47```
48
49<!-- prettier-ignore -->
50```css
51@import url("foo.css");
52```
53
54<!-- prettier-ignore -->
55```css
56@document domain('http://www.w3.org/');
57```
58
59<!-- prettier-ignore -->
60```css
61@font-face { font-family: "foo"; src: url("foo.ttf"); }
62```
63
64<!-- prettier-ignore -->
65```css
66@-moz-document url-prefix('') {}
67```
68
69### `"never"`
70
71Urls _must never_ be quoted.
72
73The following patterns are considered violations:
74
75<!-- prettier-ignore -->
76```css
77a { background: url('x.jpg'); }
78```
79
80<!-- prettier-ignore -->
81```css
82@import url("foo.css");
83```
84
85<!-- prettier-ignore -->
86```css
87@font-face { font-family: "foo"; src: url('foo.ttf'); }
88```
89
90The following patterns are _not_ considered violations:
91
92<!-- prettier-ignore -->
93```css
94a { background: url(x.jpg); }
95```
96
97<!-- prettier-ignore -->
98```css
99@import url(foo.css);
100```
101
102<!-- prettier-ignore -->
103```css
104@font-face { font-family: 'foo'; src: url(foo.ttf); }
105```
106
107## Optional secondary options
108
109### `except: ["empty"]`
110
111Reverse the primary option for functions that have no arguments.
112
113For example, with `"always"`.
114
115The following patterns are _not_ considered violations:
116
117<!-- prettier-ignore -->
118```css
119@-moz-document url-prefix() {}
120```