1 | # function-url-scheme-whitelist
|
2 |
|
3 | **_Deprecated: Instead use the [`function-url-scheme-allowed-list`](../function-url-scheme-allowed-list/README.md) rule._**
|
4 |
|
5 | Specify a list of allowed URL schemes.
|
6 |
|
7 |
|
8 | ```css
|
9 | a { background-image: url('http://www.example.com/file.jpg'); }
|
10 | /** ↑
|
11 | * This URL scheme */
|
12 | ```
|
13 |
|
14 | A [URL scheme](https://url.spec.whatwg.org/#syntax-url-scheme) consists of alphanumeric, `+`, `-`, and `.` characters. It can appear at the start of a URL and is followed by `:`.
|
15 |
|
16 | This rule ignores:
|
17 |
|
18 | - URL arguments without an existing URL scheme
|
19 | - URL arguments with variables or variable interpolation (`$sass`, `@less`, `--custom-property`, `#{$var}`, `@{var}`, `$(var)`)
|
20 |
|
21 | ## Options
|
22 |
|
23 | `array|string|regex`: `["array", "of", /schemes/ or "/regex/"]|"scheme"|/regex/`
|
24 |
|
25 | Given:
|
26 |
|
27 | ```
|
28 | ["data", "/^http/"]
|
29 | ```
|
30 |
|
31 | The following patterns are considered violations:
|
32 |
|
33 |
|
34 | ```css
|
35 | a { background-image: url('file://file.jpg'); }
|
36 | ```
|
37 |
|
38 | The following patterns are _not_ considered violations:
|
39 |
|
40 |
|
41 | ```css
|
42 | a { background-image: url('example.com/file.jpg'); }
|
43 | ```
|
44 |
|
45 |
|
46 | ```css
|
47 | a { background-image: url('/example.com/file.jpg'); }
|
48 | ```
|
49 |
|
50 |
|
51 | ```css
|
52 | a { background-image: url('//example.com/file.jpg'); }
|
53 | ```
|
54 |
|
55 |
|
56 | ```css
|
57 | a { background-image: url('./path/to/file.jpg'); }
|
58 | ```
|
59 |
|
60 |
|
61 | ```css
|
62 | a { background-image: url('http://www.example.com/file.jpg'); }
|
63 | ```
|
64 |
|
65 |
|
66 | ```css
|
67 | a { background-image: url('https://www.example.com/file.jpg'); }
|
68 | ```
|
69 |
|
70 |
|
71 | ```css
|
72 | a { background-image: url('HTTPS://www.example.com/file.jpg'); }
|
73 | ```
|
74 |
|
75 |
|
76 | ```css
|
77 | a { background-image: url('data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='); }
|
78 | ```
|