-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
/
Copy pathindex.html
163 lines (140 loc) · 4.07 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<link rel="stylesheet" href="/raw.css" />
<h1>Assets</h1>
<p class="base"></p>
<h2>Raw References from publicDir</h2>
<ul>
<li class="raw-js"></li>
<script src="/raw.js"></script>
<li class="raw-css">
Raw CSS from publicDir should load (this should be red)
</li>
<li>
Filename with whitespace
<img src="/white space.png" />
</li>
<li>
Outer file using @fs
<img class="asset-outer-img" alt="img" />
</li>
</ul>
<h2>Asset Imports from JS</h2>
<ul>
<li>Relative: <code class="asset-import-relative"></code></li>
<li>Absolute: <code class="asset-import-absolute"></code></li>
<li>Outer (@fs): <code class="asset-import-outer"></code></li>
<li>From publicDir: <code class="public-import"></code></li>
</ul>
<h2>CSS url references</h2>
<div>Font should be loaded (all text should be italic)</div>
<div class="css-url-absolute">
<span style="background: #fff">CSS background (absolute)</span>
</div>
<div class="css-url-relative">
<span style="background: #fff">CSS background (relative)</span>
</div>
<div class="css-image-set-relative">
<span style="background: #fff"
>CSS background with image-set() (relative)</span
>
</div>
<div class="css-image-set-without-url-call">
<span style="background: #fff"
>CSS background with image-set() (relative)</span
>
</div>
<div class="css-url-relative-at-imported">
<span style="background: #fff"
>CSS background (relative from @imported file in different dir)</span
>
</div>
<div class="css-url-public">
<span style="background: #fff">CSS background (public)</span>
</div>
<div class="css-url-data-uri">
<span style="background: #fff">CSS background (data URI)</span>
</div>
<div class="css-url-base64-inline">
<span style="background: #fff">CSS background (base64 inline in prod)</span>
</div>
<div class="css-url-quotes-base64-inline">
<span style="background: #fff">CSS background (base64 inline in prod)</span>
</div>
<div class="css-url-same-line">
<span style="background: #fff"
>CSS background (multiple urls on same line)</span
>
</div>
<div class="css-url-aliased">
<span style="background: #fff">CSS background (aliased)</span>
</div>
<h2>Image Src Set</h2>
<div>
<img
class="img-src-set"
src="./nested/asset.png"
srcset="./nested/asset.png 1x, ./nested/asset.png 2x"
alt=""
/>
</div>
<h2>SVG Fragments</h2>
<div>
<img
class="svg-frag-img"
src="./nested/fragment.svg#icon-clock-view"
alt=""
/>
<img
class="svg-frag-img"
src="./nested/fragment.svg#icon-heart-view"
alt=""
/>
<img
class="svg-frag-img"
src="./nested/fragment.svg#icon-arrow-right-view"
alt=""
/>
</div>
<h2>SVG Fragments via CSS background url</h2>
<div>
<span class="icon icon-clock"></span>
<span class="icon icon-heart"></span>
<span class="icon icon-arrow-right"></span>
</div>
<h2>SVG Fragments via JS Import</h2>
<div>
<p>Imported path: <code class="svg-frag-import-path"></code></p>
<img class="svg-frag-import" alt="" />
</div>
<h2>?raw import</h2>
<code class="raw"></code>
<h2>?url import</h2>
<code class="url"></code>
<script type="module">
import './css/fonts.css'
import './css/css-url.css'
import './css/icons.css'
text('.base', `import.meta.${``}env.BASE_URL: ${import.meta.env.BASE_URL}`)
import url from './nested/asset.png'
text('.asset-import-relative', url)
import absoluteUrl from '/nested/asset.png'
text('.asset-import-absolute', absoluteUrl)
import outerUrl from '@playground/css/nested/asset.png'
text('.asset-import-outer', outerUrl)
src('.asset-outer-img', outerUrl)
import publicUrl from '/icon.png'
text('.public-import', publicUrl)
import svgFrag from './nested/fragment.svg'
text('.svg-frag-import-path', svgFrag)
document.querySelector('.svg-frag-import').src = svgFrag + '#icon-heart-view'
import rawSvg from './nested/fragment.svg?raw'
text('.raw', rawSvg)
import fooUrl from './foo.js?url'
text('.url', fooUrl)
function text(el, text) {
document.querySelector(el).textContent = text
}
function src(el, src) {
document.querySelector(el).src = src
}
</script>