aboutsummaryrefslogtreecommitdiff
path: root/build/1kb
diff options
context:
space:
mode:
Diffstat (limited to 'build/1kb')
-rw-r--r--build/1kb/index.html27
1 files changed, 2 insertions, 25 deletions
diff --git a/build/1kb/index.html b/build/1kb/index.html
index 389b489..4f3bee8 100644
--- a/build/1kb/index.html
+++ b/build/1kb/index.html
@@ -3,11 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
<link rel="icon" href="data:,">
<title>Making a Website Under 1kB</title>
<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
-<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
@@ -16,63 +17,39 @@
<main>
<h1 id="making-a-website-under-1kb">Making a Website Under 1kB</h1>
-
<p>2022-08-02</p>
-
<p>I recently launched (another) website club called the <a href="https://1kb.club">1kB Club</a>. Unlike the <a href="https://1mb.club">1MB Club</a>, it isn&#8217;t as accessible for most modern websites to become official members. Building a website that actually serves useful content while squeezing its page size under 1,024 bytes is no easy feat.</p>
-
<p>But it is possible. And I did it myself!</p>
-
<p><em>Note:</em> Big shout-out to <a href="https://t0.vc">Tanner</a>, who inspired this whole &#8220;movement&#8221; with his own minimal website. (He also has some really great creations&#47;articles there too!)</p>
-
<h2 id="the-html">The HTML</h2>
-
<p>For reference, you can view my &#8220;mini&#8221; website here: <a href="https://cv.tdarb.org">cv.tdarb.org</a>. It is <em>very</em> minimal and serves only as a personal curriculum vitae. It also weighs only <strong>920 bytes</strong> and is valid HTML.</p>
-
<p>Let&#8217;s take a look at the full HTML and then break things down from there:</p>
-
<pre><code>&#60;!DOCTYPE html&#62;&#60;link rel="icon" href="data:,"&#62;&#60;meta name="viewport" content="width=device-width,initial-scale=1.0"&#62;&#60;title&#62;CV&#60;&#47;title&#62;&#60;p&#62;Hi, I&#39;m &#60;a href="t"&#62;Brad Taunt&#60;&#47;a&#62;! I&#39;m a UX designer.&#60;p&#62;Email: hello@tdarb.org&#60;p&#62;Resume&#60;p&#62;Senior Product Designer @ Donorbox, 2021-&#60;br&#62;Web Designer @ Purism, 2019-2021&#60;br&#62;Product Designer @ Benbria, 2013-2019&#60;br&#62;Web Designer @ Netvatise, 2009-2013&#60;p&#62;Projects&#60;p&#62;&#60;a href="1"&#62;1MB Club&#60;&#47;a&#62;&#60;br&#62;&#60;a href="k"&#62;1kB Club&#60;&#47;a&#62;&#60;br&#62;&#60;a href="p"&#62;pblog&#60;&#47;a&#62;&#60;br&#62;&#60;a href="s"&#62;shinobi&#60;&#47;a&#62;&#60;br&#62;&#60;a href="h"&#62;PHPetite&#60;&#47;a&#62;&#60;br&#62;&#60;a href="v"&#62;Vanilla CSS&#60;&#47;a&#62;&#60;p&#62;Writing&#60;p&#62;&#60;a href="d"&#62;The Death of Personality&#60;&#47;a&#62;&#60;br&#62;&#60;a href="u"&#62;Simple Does Not Mean Ugly&#60;&#47;a&#62;&#60;br&#62;&#60;a href="e"&#62;Plain Text Emails, Please&#60;&#47;a&#62;&#60;br&#62;&#60;a href="tb"&#62;[more]&#60;&#47;a&#62;
</code></pre>
-
<h2 id="sneaky-hacks">Sneaky &#8220;Hacks&#8221;</h2>
-
<p>The first thing you&#8217;ll notice is that the HTML is compressed. White space adds extra bytes of data to the page weight - so it needs to go. Next, you might have caught the <em>odd</em> favicon meta tag:</p>
-
<pre><code>&#60;link rel="icon" href="data:,"&#62;
</code></pre>
-
<p>This is required to stop the browser from making the standard favicon request (normally pulling from <code>favicon.ico</code>). By adding this meta tag you are telling the browser to load in an empty image without running another server request. This saves about 400 bytes of bandwidth on its own!</p>
-
<p>The next two meta tags after the <code>icon</code> are technically optional. These are the <code>viewport</code> and <code>title</code> tags. You could save a good amount of data by excluding them altogether, but I had my own personal reasons for keeping them:</p>
-
<ol>
<li>I wanted the web page to be responsive</li>
<li>I wanted the page to be <a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fcv.tdarb.org%2F">valid HTML</a></li>
</ol>
-
<p>So, I kept these tags but made them as minimal as I possibly could (looking at you <code>title</code> tag). After that, it was time to add my content!</p>
-
<h2 id="where-were-going-we-dont-need-tags">Where We&#8217;re Going, We Don&#8217;t Need Tags&#8230;</h2>
-
<p>The beauty of using HTML5 is the ability to ditch &#8220;default&#8221; and closing tags on most elements. Think of all those bytes we can save!</p>
-
<p>In the HTML above you will notice:</p>
-
<ol>
<li>There is no <code>html</code> element</li>
<li>There is no <code>head</code> element</li>
<li>There is no <code>body</code> element</li>
<li>There are no closing <code>p</code> tags</li>
</ol>
-
<p>Even with all those &#8220;missing&#8221; elements, the webpage is still valid HTML5! Craziness.</p>
-
<p>The final hack that saved a <em>ton</em> of bandwidth was implementing custom <code>href</code> URLs. Most of the links on the page take the user to another website altogether - which is fine. The problem is including these full domains inside the <code>a:href</code> tag. Those can start to eat up a lot of data.</p>
-
<p>Luckily, I host this mini-site through Netlify so I can take full advantage of their optional <code>_redirects</code> file. Links are now set with a single character (ie. &#8220;1&#8221; for the 1MB Club link) and the <code>_redirects</code> file simply forwards the user to the custom domain. Pretty sneaky!</p>
-
<h2 id="closing-thoughts">Closing Thoughts</h2>
-
<p>This is a silly project that isn&#8217;t meant to be taken so seriously. That being said, I&#8217;d love to see what other pages people are able to create while being limited to just 1kB.</p>
<footer role="contentinfo">
<h2>Menu Navigation</h2>