-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.html
398 lines (368 loc) · 13.9 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="normal" />
<meta name="theme-color" content="#342f3a" />
<!-- Regular Meta Tags -->
<meta
name="name"
content="Strawberry - Zero-Dependency, Build-Free JavaScript Framework"
/>
<meta
name="title"
content="Strawberry - Zero-Dependency, Build-Free JavaScript Framework"
/>
<meta
name="description"
content="Zero-dependency, build-free JavaScript framework for the artisanal web."
/>
<meta name="image" content="https://strawberry.quest/assets/banner.png" />
<meta name="language" content="en-US" />
<!-- OG Meta Tags -->
<meta
property="og:title"
content="Strawberry - Zero-Dependency, Build-Free JavaScript Framework"
/>
<meta
property="og:description"
content="Zero-dependency, build-free JavaScript framework for the artisanal web."
/>
<meta
property="og:image"
content="https://strawberry.quest/assets/banner.png"
/>
<!-- Twitter Meta Tags -->
<meta
name="twitter:title"
content="Strawberry - Zero-Dependency, Build-Free JavaScript Framework"
/>
<meta
name="twitter:description"
content="Zero-dependency, build-free JavaScript framework for the artisanal web."
/>
<meta
name="twitter:image"
content="https://strawberry.quest/assets/banner.png"
/>
<meta name="twitter:site" content="@18alantom" />
<meta name="twitter:card" content="summary_large_image" />
<title>Strawberry - Zero-Dependency, Build-Free JavaScript Framework</title>
<link rel="shortcut icon" href="assets/sb.png" />
<link rel="stylesheet" href="assets/index.css" />
<link
rel="preload"
as="font"
type="font/woff2"
href="assets/fonts/press-start-2p-latin.woff2"
crossorigin
/>
<link
rel="preload"
as="font"
type="font/woff2"
href="assets/fonts/vt323-latin.woff2"
crossorigin
/>
<link rel="preload" as="image" href="assets/sb.png" />
<link
rel="preload"
as="image"
type="image/svg+xml"
href="assets/grid.svg"
/>
<!-- Loading Highlight JS and Example Manager -->
<script id="hl-script" src="highlight.min.js" async></script>
<script src="index.js" async></script>
</head>
<body>
<!-- Header -->
<header>
<a
href="https://www.pixilart.com/art/strawberry-sr27182e5bff14b"
target="_blank"
rel="noreferrer"
>
<div id="banner"></div>
</a>
<h1>Strawberry</h1>
<p>Zero-dependency, build-free framework for the artisanal web.</p>
</header>
<!-- Lead-in Section -->
<section id="leadin">
<p>
Strawberry is a tiny frontend framework that gives you reactivity and
composability. It does this with zero-dependencies, without a build
step, and it fits in less than 4KB when gzipped.
</p>
</section>
<pre
id="simple-example"
><code class="copy hljs nohighlight" data-copy="Copy"><span class="hljs-comment"><!-- Define Components --></span>
<span class="hljs-tag"><<span class="hljs-name">template</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"plum-p"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"color: plum"</span>></span><span class="hljs-tag"><<span class="hljs-name">slot</span> /></span><span class="hljs-tag"></<span class="hljs-name">p</span>></span>
<span class="hljs-tag"></<span class="hljs-name">template</span>></span>
<span class="hljs-comment"><!-- Initialize Strawberry --></span>
<span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="language-javascript">
<span class="hljs-keyword">const</span> data = sb.<span class="hljs-title function_">init</span>();
</span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
<span class="hljs-comment"><!-- Use Components --></span>
<span class="hljs-tag"><<span class="hljs-name">plum-p</span> <span class="hljs-attr">sb-mark</span>=<span class="hljs-string">"message"</span>></span>
A plum colored p element!
<span class="hljs-tag"></<span class="hljs-name">plum-p</span>></span>
<span class="hljs-comment"><!-- Dynamically Update Components --></span>
<span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="language-javascript">
data.<span class="hljs-property">message</span> = <span class="hljs-string">'Hello, World!'</span>;
</span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
<!-- Nav Bar -->
<nav class="navbar">
<a
href="https://github.com/18alantom/strawberry"
target="_blank"
rel="noreferrer"
>Github</a
>
<a
href="https://github.com/18alantom/strawberry/tree/main/docs"
target="_blank"
rel="noreferrer"
>Docs</a
>
</nav>
<section id="usecase" class="blank-block">
<p>
Strawberry is <em>not</em> an alternative to React, Vue, etc. It is an
alternative to Vanilla JS. It is meant for simple, long lasting, low
maintenance web pages, and <em>tiny</em> web apps.
</p>
</section>
<!-- Basic Setup -->
<section id="setup" class="block">
<h2>Basic Setup</h2>
<p>For a basic setup, run this command in your terminal:</p>
<pre><code class="copy hljs nohighlight" data-copy="Copy"><span class="hljs-keyword">curl</span> <span class="hljs-property">-so-</span> https://raw.githubusercontent.com/18alantom/strawberry/main/setup.sh <span class="hljs-meta">|</span> <span class="hljs-keyword">bash</span></code></pre>
<p>
This will download and run a
<a
href="https://github.com/18alantom/strawberry/blob/main/setup.sh"
target="_blank"
rel="noreferrer"
>shell script</a
>
that creates a folder with two files, <code>index.html</code> and
<code>sb.min.js</code> which consists of a simple "Hello, World!"
program using Strawberry.
</p>
<p>
To verify that setup succeeded, run the created
<code>index.html</code> file and check the console for the
<code>window.sb</code> object.
</p>
</section>
<section class="blank-block">
<p>
The ideal way of using Strawberry is by copying the source code into
your project directory as opposed to linking it.
</p>
<p>But if you want to use a link, you can :)</p>
</section>
<!-- Setup -->
<section id="setup" class="block">
<h2>Link Setup</h2>
<p>
To use a link, copy and paste the following script tag at the top of
your <code>index.html</code>:
</p>
<pre><code class="copy hljs nohighlight" data-copy="Copy"><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://unpkg.com/sberry@0.0.3-alpha.0/dist/sb.min.js"</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
<p>
Once that is done the <code>window.sb</code> object should be defined.
</p>
</section>
<div class="sb-break" id="inventory-example">
<hr />
<img src="assets/sb.png" />
<hr />
</div>
<section class="blank-block">
<p>
Here's a toy example using Strawberry. An inventory app in which you can
add items, move them in and out of a store, and view the movements.
</p>
</section>
<!-- Inventory Example -->
<div class="toggle">
<div id="screen">
<!-- Display -->
<div id="view" class="codeblock" data-tab="view"></div>
<!-- Head Element Editor -->
<div class="codeblock" id="head" style="display: none" data-tab="head">
<pre><code style="cursor: pointer" class="language-html"></code></pre>
<textarea spellcheck="false" style="display: none"></textarea>
</div>
<!-- Templates Editor -->
<div
class="codeblock"
id="templates"
style="display: none"
data-tab="templates"
>
<pre><code style="cursor: pointer" class="language-html"></code></pre>
<textarea spellcheck="false" style="display: none"></textarea>
</div>
<!-- Body Element Editor -->
<div class="codeblock" id="body" style="display: none" data-tab="body">
<pre><code style="cursor: pointer" class="language-html"></code></pre>
<textarea spellcheck="false" style="display: none"></textarea>
</div>
<!-- Script Element Editor -->
<div
class="codeblock"
id="script"
style="display: none"
data-tab="script"
>
<pre><code style="cursor: pointer; " class="language-javascript"></code></pre>
<textarea spellcheck="false" style="display: none"></textarea>
</div>
<!-- Consolidated HTML Viewer -->
<div class="codeblock" id="html" style="display: none" data-tab="html">
<pre><code class="language-html"></code></pre>
</div>
</div>
<div id="buttons">
<div id="tabs">
<button data-tab="view" data-active="true">View</button>
<button data-tab="head">Head</button>
<button data-tab="templates">Templates</button>
<button data-tab="body">Body</button>
<button data-tab="script">Script</button>
<button data-tab="html">HTML</button>
</div>
<button id="reset">Reset</button>
</div>
</div>
<section class="blank-block">
<p>
Click the buttons in the bottom bar to view the different parts of the
page.
</p>
<ul>
<li><b>Head</b>: contains styles and a script to link Strawberry.</li>
<li>
<b>Templates</b>: contains templates for inventory list (blue) item
and movement item (dark-blue)
</li>
<li><b>Body</b>: contains the markup of the app.</li>
<li>
<b>Script</b>: contains Strawberry code, "business logic", click
handlers, and demo data.
</li>
<li>
<b>HTML</b>: contains HTML created by consolidating the other parts.
This is used to run the app (and is a readonly view).
</li>
</ul>
<p>
Clicking the code will allow you to edit it in a
<code>textarea</code>, switching back to "View" will allow you to see
your changes.
</p>
</section>
<div class="sb-break">
<hr />
<img src="assets/sb.png" />
<hr />
</div>
<!-- Why -->
<section id="why" class="blank-block">
<blockquote>Why did you make this?</blockquote>
<p>I wanted to write a simple website.</p>
<p>
I restrained myself from using the usual frontend frameworks; for my
purpose, their murder of dependencies felt like gross computational
opulence.
</p>
<p>
These previously, on annual re-visitation, instead of showing me my
website after an innocuous <code>yarn build</code>, have sprawled my
terminal with scary red text; portent of wasted hours.
</p>
<blockquote>If it ran then. It should've run now.</blockquote>
<p>
But as I wrote my website, the need to manually update the UI and
redefine components took away from writing the site.
</p>
<p>
And so it was created after an afternoon JavaScript experiment. A
framework for people who just want to write simple websites with a
smattering of JavaScript, and without having to <em>build</em> things
that probably might not.
</p>
</section>
<!-- Quote Douglas Crockford -->
<section class="block">
<h2 style="background-color: var(--green)">
Douglas Crockford on the XML of today
</h2>
<p>
These are excerpts from the CoRecursive podcast on
<a
href="https://corecursive.com/json-vs-xml-douglas-crockford/"
target="_blank"
rel="noreferrer"
>JSON vs XML</a
>.
</p>
<blockquote>
It’s probably the JavaScript frameworks. They have gotten so big and so
weird. People seem to love them. I don’t understand why.
</blockquote>
<p>And on web APIs.</p>
<blockquote>
...the browsers have actually gotten pretty good. The web standards
thing have finally worked, and the web API is stable pretty much. Some
of it’s still pretty stupid, but it works and it’s reliable.
</blockquote>
<p>
Read the transcript on
<a
href="https://corecursive.com/json-vs-xml-douglas-crockford/#javascript-frameworks"
target="_blank"
rel="noreferrer"
>CoRecursive</a
>.
</p>
</section>
<footer class="blank-block">
<p>
<a
href="https://18alan.space/posts/how-hard-is-it-to-build-a-frontend-framework.html"
target="_blank"
rel="noreferrer"
>How it works</a
>
·
<a
href="https://github.com/18alantom/strawberry/blob/main/website/index.html"
target="_blank"
rel="noreferrer"
>Website code</a
>
</p>
<p>
Made with
<img
src="assets/heart.png"
style="width: 22px; height: 22px; margin-bottom: -5px"
/>
by
<a href="https://twitter.com/18alantom" target="_blank" rel="noreferrer"
>Alan</a
>
</p>
<p>©2023</p>
</footer>
</body>
</html>