1 | # function-url-no-scheme-relative
|
2 |
|
3 | Disallow scheme-relative urls.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { background-image: url('//www.google.com/file.jpg'); }
|
8 | /** ↑
|
9 | * This scheme-relative url */
|
10 | ```
|
11 |
|
12 | A [scheme-relative url](https://url.spec.whatwg.org/#syntax-url-scheme-relative) is a url that begins with `//` followed by a host.
|
13 |
|
14 | This rule ignores url arguments that are variables (`$sass`, `@less`, `--custom-property`).
|
15 |
|
16 | ## Options
|
17 |
|
18 | ### `true`
|
19 |
|
20 | The following patterns are considered violations:
|
21 |
|
22 |
|
23 | ```css
|
24 | a {
|
25 | background: url("//www.google.com/file.jpg");
|
26 | }
|
27 | ```
|
28 |
|
29 | The following patterns are _not_ considered violations:
|
30 |
|
31 |
|
32 | ```css
|
33 | a {
|
34 | background: url("../file.jpg");
|
35 | }
|
36 | ```
|
37 |
|
38 |
|
39 | ```css
|
40 | a {
|
41 | background: url("http://www.google.com/file.jpg");
|
42 | }
|
43 | ```
|
44 |
|
45 |
|
46 | ```css
|
47 | a {
|
48 | background: url("/path/to/file.jpg");
|
49 | }
|
50 | ```
|