<?xml version="1.0" encoding="utf-8"?>
  <rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:georss="http://www.georss.org/georss"
    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
  >
    <channel>
      <title>Piccalilli - Explainer topic archive</title>
      <link>https://piccalil.li/</link>
      <atom:link href="https://piccalil.li/category/explainer.xml" rel="self" type="application/rss+xml" />
      <description>We are Piccalilli. A publication dedicated to providing high quality educational content to level up your front-end skills.</description>
      <language>en-GB</language>
      <copyright>Piccalilli - Explainer topic archive 2026</copyright>
      <docs>https://www.rssboard.org/rss-specification</docs>
      <pubDate>Tue, 07 Apr 2026 01:02:02 GMT</pubDate>
      <lastBuildDate>Tue, 07 Apr 2026 01:02:02 GMT</lastBuildDate>

      
      <item>
        <title>How the heck does it work? Phoenix LiveView</title>
        <link>https://piccalil.li/blog/how-the-heck-does-it-work-phoenix-liveview/?ref=explainer-category-rss-feed</link>
        <dc:creator><![CDATA[Alessandro Mencarini]]></dc:creator>
        <pubDate>Tue, 15 Oct 2024 11:32:06 GMT</pubDate>
        <guid isPermaLink="true">https://piccalil.li/blog/how-the-heck-does-it-work-phoenix-liveview/?ref=explainer-category-rss-feed</guid>
        <description><![CDATA[<p>Let’s start with a brief, mostly subjective history of web tech.</p>
<p>A long long time ago, web development was pretty much a single discipline where any developer would work throughout their stack. Most would be armed with a backend language or framework, HTML and CSS, with a sprinkle of JavaScript.</p>
<p>Then the demands for richer and richer user interactions in web applications pushed us in a very different direction. Front-end development became its own discipline and a bunch of new technologies emerged.</p>
<h2>The front-end framework overload</h2>
<p>On a semi-regular schedule, backend specialists would read news about the latest and greatest frontend framework / metaframework / library and increasingly channel their inner <a href="https://www.youtube.com/watch?v=d3PKE8uTSp8">Brenda from Bristol</a> shouting "You're joking! Not <em>another</em> one!"</p>
<p>Something broke in the community of folks that have long identified as full-stack web developers, and the quest for a different model started. The mission: find a technology based on a single programming language to drive the backend business logic and frontend user interaction.</p>
<h2>The pendulum shifts again</h2>
<p>After some toying with <em>isomorphic apps</em>, two paradigms emerged that allow full-stack developers to take back control of their stacks:</p>
<ol>
<li>React everywhere, such as <em>Next.js</em> and <em>Remix</em></li>
<li>Backend-driven frontend, such as <em>Phoenix LiveView (LiveView)</em> and <em>htmx</em></li>
</ol>
<h2>Enter LiveView</h2>
<p><a href="https://www.phoenixframework.org/">LiveView</a> is built on top of the <em>Phoenix web framework</em>, and leverages some interesting features of Elixir — the language it's written in — along with <em>Erlang</em> and its virtual machine, <em>the BEAM</em>. Its model inspired similar frameworks: <em>HotWire</em> in the Ruby/Rails world, <em>LiveWire</em> in PHP and <em>Laravel</em>.</p>
<p>Some big users of <em>LiveView</em> are <a href="http://cars.com/">cars.com</a> and <a href="http://fly.io/">Fly.io</a> (who as of October 2024 employs Chris McCord, the author of <em>Phoenix</em> and <em>LiveView</em>).</p>
<h2>How does LiveView work</h2>
<p>Let's have a look at what happens when a user hits a LiveView enabled page.</p>
<p>You can follow along and admire my web design skills by having a look at <a href="https://vacant-lined-foal.gigalixirapp.com/">a very simple example app I wrote</a> and <a href="https://github.com/amencarini/liveview-counter">its source code</a>.</p>
<p><a href="https://vacant-lined-foal.gigalixirapp.com/">Check it out</a></p>
<h3>Step 1: Initial render</h3>
<p>The first request-response cycle is the same you'd encounter with any classic web framework. The user asks for an HTTP resource, the server stitches together some HTML and ships it back to the browser.</p>
<p>This enables the page to be fully rendered no matter what comes next, which has nice properties for search engines (and any other manner of dodgy crawler… I'm looking at <em>you</em>, LLMs trainer bots) and can enable some basic usage even on bad network or low bandwidth conditions. Y’know, <a href="https://piccalil.li/blog/its-about-time-i-tried-to-explain-what-progressive-enhancement-actually-is/">progressive enhancement</a>.</p>
<p>The dynamic content gets handled in the same way by both the initial render and the LiveView first render:</p>
<pre><code>&lt;div&gt;
  Count: &lt;%= @count %&gt;
&lt;/div&gt;
</code></pre>
<p><a href="https://github.com/amencarini/liveview-counter/blob/main/lib/calculator_web/live/counter_live.html.heex#L1-L3">Source</a></p>
<p>In the <em>Phoenix</em> parlance, <code>@count</code> is called an "assign". It gets calculated in the <code>mount</code> function and injected in the template:</p>
<pre><code>def mount(_params, _session, socket) do
  {:ok, socket |&gt; assign(:count, 0)}
end
</code></pre>
<p><a href="https://github.com/amencarini/liveview-counter/blob/main/lib/calculator_web/live/counter.ex#L5-L7">Source</a></p>
<p>In this case, <code>count</code> is the integer <code>0</code>, but assigns can be any valid data structure: a list, a map, a struct… The sky’s the limit. Well, the sky, and your server’s RAM.</p>
<h3>Step 2: The View becomes Live</h3>
<p>The page that gets delivered has a sprinkle of JS: most importantly, it carries the code to request a WebSocket connection to the server. The HTML gets re-rendered and a "process" — such as a lightweight thread — starts on the server to store the current state of the view the user is engaging with. For all intents and purposes, the app is now stateful.</p>
<p>Depending on the complexity of such processes, <a href="https://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections">Elixir can handle <em>a lot</em> of them on a single machine</a>, fairly efficiently. It takes a lot of beating before the user experience is actually degradated thanks to the BEAM’s scheduler.</p>
<h3>Step 3: The reactive cycle begins</h3>
<p>How does the app becomes interactive? By providing bindings on the page. For example, a DOM element with the <code>phx-click="increment"</code> HTML attribute informs the small JavaScript library to push the <code>increment</code> event up the WebSocket whenever it's clicked.</p>
<pre><code>&lt;div&gt;
  &lt;button type="button" phx-click="increment"&gt;+&lt;/button&gt;

  &lt;button type="button" phx-click="decrement"&gt;-&lt;/button&gt;
&lt;/div&gt;
</code></pre>
<p><a href="https://github.com/amencarini/liveview-counter/blob/main/lib/calculator_web/live/counter_live.html.heex#L5-L9">Source</a></p>
<p>The LiveView then handles the event, and adds 1 to the count.</p>
<pre><code>def handle_event("increment", _, socket) do
  count = socket.assigns[:count]

  {:noreply, socket |&gt; assign(:count, count + 1)}
end
</code></pre>
<p><a href="https://github.com/amencarini/liveview-counter/blob/main/lib/calculator_web/live/counter.ex#L10-L14">Source</a></p>
<p>If the state causes the rendering to change — which will happen in this case as the assign <code>@count</code> will change — the LiveView process pushes the relevant, minimal diffs back to the browser via the WebSocket. Here's an example from the network inspector:</p>
<pre><code>up:
["4","13","lv:phx-F_lyW6ngKkiixRwB","event",{"type":"click","event":"increment","value":{"value":""}}]

down:
["4","13","lv:phx-F_lyW6ngKkiixRwB","phx_reply",{"status":"ok","response":{"diff":{"1":{"0":"1"}}}}]
</code></pre>
<p>In this case <code>{"diff":{"1":{"0":"1"}}}</code> tells the client JavaScript library to replace the slot <code>0</code> (the <code>&lt;%= @count %&gt;</code> tag we saw above) with just the content <code>1</code>. Obviously more complex apps will pass more complex diffs, but the basics are the same.</p>
<p>The JavaScript library then updates the DOM, and now we're ready for the next event to trigger.</p>
<h2>What else does it do</h2>
<h3>On-browser commands</h3>
<p><a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.JS.html"><code>LiveView.JS</code></a> module allows you to write simple but extensive browser-based CSS manipulations without the need of a roundtrip over the web socket. Hiding and showing DOM elements or toggling classes is trivial and can be still controlled without writing a single line of JavaScript.</p>
<h3>A lot of heavy lifting for you</h3>
<p>Think of a React app: you need to stitch your frontend and backend together with a bunch of things to make it work, like auth, an API layer, a separate build pipeline, ideally some tests. <em>LiveView</em> takes away all the glue work, and you can focus on delivering features instead.</p>
<h3>Session tracking across the cluster</h3>
<p>One of the most interesting aspects of using the BEAM, is that you can cluster all your servers together and allow module calls across them. This is referred in the community as <a href="https://www.erlang.org/doc/system/distributed.html">Distributed Erlang</a>. If you do build such cluster, and a user's session gets lost and then reconnected with a different server, the new server can fetch the state from the previous one.</p>
<h2>Wrapping up</h2>
<p><a href="https://www.phoenixframework.org/">LiveView</a> can empower developers to create rich apps by focusing on a single programming language and a single framework (or a framework and a half, more realistically, if we count both Phoenix and LiveView). With LiveView, you can cut down on a lot of glue work, and it supports <a href="https://piccalil.li/blog/its-about-time-i-tried-to-explain-what-progressive-enhancement-actually-is/">progressive enhancement</a> where useful: if you need a non-JavaScript fallback, you can build a non-LiveView, traditional View-Controller route in Phoenix.</p>
<p>It’s not all unicorns and flowers though. While LiveView's approach works for the vast majority of simple apps, something like <em>Google Maps</em> is too complex for it to handle. Similarly, offline support is out of the question. Lastly, LiveView is extremely niche compared to <em>React</em>; the resources available are proportionally scarce.</p>
<h3>A glimpse of simplicity</h3>
<p>I hope this gave you an overview on what happens in some dark corners of the web that aren’t following the herd that brought us <a href="https://infrequently.org/2023/02/the-market-for-lemons/">the current set of mainstream unwieldy technologies</a>. I’m increasingly optimistic about the direction web frameworks are taking in terms of productivity and I’m excited about the industry adoption of these new patterns.</p>
        
        ]]></description>
        
      </item>
    
      <item>
        <title>A quick and easy guide to Markdown</title>
        <link>https://piccalil.li/blog/a-quick-and-easy-guide-to-markdown/?ref=explainer-category-rss-feed</link>
        <dc:creator><![CDATA[Andy Bell]]></dc:creator>
        <pubDate>Tue, 11 Jun 2024 10:55:08 GMT</pubDate>
        <guid isPermaLink="true">https://piccalil.li/blog/a-quick-and-easy-guide-to-markdown/?ref=explainer-category-rss-feed</guid>
        <description><![CDATA[<p>This guide is designed to help everyone with Markdown, even if they have never written it before. It is <strong>deliberately simple</strong>. There’s links to further resources and learning at the end of the article.</p>
<p>I’m not going to spend ages explaining what Markdown is or how it works because <a href="https://www.Markdownguide.org/getting-started/">there’s already great resources for that</a>. Instead, I’m going to break down the <strong>most important aspects</strong> of Markdown with quick and easy snippets so you can start composing great content!</p>
<h2>Headings</h2>
<p>Markdown enables you to to compose HTML heading elements by using a <code>#</code> character as a prefix. All you need to remember is that the number of <code>#</code>’s as a prefix represents the heading level.</p>
<p>For example, if you want a <code>&lt;h1&gt;</code> element, you add one <code>#</code>:</p>
<pre><code># I am a heading level 1
</code></pre>
<p>If you want a <code>&lt;h3&gt;</code> element, you add three <code>#</code>’s:</p>
<pre><code>### I am a heading level 3 
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/MWdEgvZ/0933fe94d1bd51dff4d23eff9733ad7a">Markdown headings</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Paragraphs</h2>
<p>To create a <code>&lt;p&gt;</code> — which is a paragraph element — add a new line between sections of text. <strong>Make sure you press Enter without holding down the shift key</strong>.</p>
<pre><code>This is a paragraph of text which can contain as many words as you like.

This is another paragraph of text, seperated with a new line. You don’t have to do anything else other than create a new line between paragraphs. 
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/PovJYEJ/2c9e18e71f62c1e0e733cc4cfa85bf98">Markdown paragraphs</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Bold text</h2>
<p>To make text bold, wrap it in <code>**</code> characters on each side of the text like so:</p>
<pre><code>This is some text with **a section of bold content**. 
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/XWwerVL/c2fa6ef9931106d2ba934a0d58264919">Markdown bold text</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Italic/emphasised text</h2>
<p>This is very similar to making text bold. Instead of two <code>*</code> characters, you only use one for italic/emphasised text.</p>
<pre><code>This is some text with a *section of italic text*.
</code></pre>
<div><h2>FYI</h2>
<p>You can also use an underscore to wrap italicised/emphasised text like this:</p>
<pre><code>This is some text with a _section of italic text_.
</code></pre>
</div>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/JjqrPpd/9a3c2f3a45042e78d0317f108a9a1c29">Markdown italic text</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Strikethrough/deleted text</h2>
<p>To apply a strikethrough to your text, Markdown allows you to generate a <code>&lt;del&gt;</code> tag by wrapping it in <code>~~</code>, like so:</p>
<pre><code>A paragraph with some ~~strikethrough text~~.
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/JjqrPLY/0a64c10c01e4e94b0b8e6e8bcdf90cae">Markdown strikethrough/deleted text</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<div><h2>FYI</h2>
<p>In Slack, use a single <code>~</code> character. It <em>should</em> be a double character (<code>~~</code>), but here we are 🙃</p>
</div>
<h2>Links</h2>
<p>To apply a link, wrap the text in square brackets. That’s starting with an <code>[</code> character and finishing with a <code>]</code> character. This should then be immediately followed with the URL you want to link to in parentheses — also known as round brackets <code>()</code>.</p>
<p>For example, let’s say I want to create a link to the BBC:</p>
<pre><code>[The BBC](https://www.bbc.co.uk/) is a public service broadcaster in the UK. 
</code></pre>
<p>Markdown can also automatically wrap URLs in links for you too. Say for example, you wanted to write <a href="https://www.bbc.co.uk">https://www.bbc.co.uk</a> that links to <code>https://www.bbc.co.uk</code>, wrap the link in an opening <code>&lt;</code> and closing <code>&gt;</code> like so:</p>
<pre><code>Visit &lt;https://www.bbc.co.uk&gt; for more info.
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/QWRqLmV/e041bd55a08fb804fbbc2a6ff3fc78cb">Markdown links</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Images</h2>
<p>Embedding an image with an <code>&lt;img&gt;</code> element is very similar to links. The only difference is the square brackets contain the <a href="https://webaim.org/techniques/alttext/">alternative text</a> and the parentheses contains a URL to the image. You also need to add a <code>!</code> character as a prefix to the square brackets:</p>
<pre><code>![A 'subscribe' button appears to sit on top of an email input which has a placeholder value of 'name@example.com'. The form is labelled 'Enter your email to sign up for our newsletter'](https://piccalil.b-cdn.net/images/blog/floating-signup-form-pattern.jpg)
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/dyEVbep/60787301bf8b14d97217c118c691b4cd">Markdown images</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Blockquotes</h2>
<p>For every line of your blockquote (<code>&lt;blockquote&gt;</code>) — <strong>including new lines</strong> — use a <code>&gt;</code> character as the prefix.</p>
<p>For example, this is a one line blockquote:</p>
<pre><code>&gt; This is a one line quote
</code></pre>
<p>And this is multiple lines:</p>
<pre><code>&gt; This is a quote that is broken into multiple lines 
&gt; 
&gt; Notice how the line above is just a &gt; character. This allows the Markdown processor to put both lines of the quote in the same `&lt;blockquote&gt;` element
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/eYaGOra/d01b80bf64cfe4ca64050c0a497fa001">Markdown blockquotes</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Horizontal rule</h2>
<p>You can apply a horizontal rule with three asterisks (<code>***</code>), three hashes (<code>---</code>) or three underscores (<code>___</code>).</p>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/WNBZeKg/f59a181fa2fa3b206e85a7d2c937e7a5">Markdown horizontal rule</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Inline code</h2>
<p>You might have noticed in the <a href="#blockquotes">blockquotes example</a> we were using the <code>`</code> character. Wrapping text in these characters renders them in a <code>&lt;code&gt;</code> element.</p>
<pre><code>If you want space between elements in CSS, use the `margin` property.
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/YzbrKOZ/c854984c2d1cd4e4dab0cc5ea7865e00">Markdown inline code</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>Code blocks</h2>
<p>You can also generate multiline code blocks by adding <code>```</code> on the line before your text and <code>```</code> on the line after your text like so:</p>
<pre><code>```
Some preformatted text. 

On multiple lines.
```
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/GRaMKYM/56ba4eb7a68956a7bed586c3285a0847">Markdown code blocks</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<div><h2>FYI</h2>
<p>You can also add the code language like this too:</p>
<pre><code>```html

```

```css

```
</code></pre>
</div>
<h2>Lists</h2>
<p>You can compose ordered (<code>&lt;ol&gt;</code>) and unordered lists (<code>&lt;ul&gt;</code>) with Markdown.</p>
<p>If you want to compose an ordered list, start each line with a number, followed by a dot, like so:</p>
<pre><code>1. I am list item one
2. I am list item two
3. I am list item three
4. I am list item four
</code></pre>
<p>You can also use the same number each time:</p>
<pre><code>1. I am list item one
1. I am list item two
1. I am list item three
1. I am list item four
</code></pre>
<p>To generate an ordered list, start each line with a <code>-</code>:</p>
<pre><code>- I am list item one
- I am list item two
- I am list item three
- I am list item four
</code></pre>
<div><h2>FYI</h2>
<p>You can also use <code>+</code> or <code>*</code> for unordered lists, but I prefer using <code>-</code> to make things easier to scan read when editing content.</p>
</div>
<p>Lastly, you can nest list items like so:</p>
<pre><code>- I am list item one
  - I am another list inside list item one
- I am list item two
  1. I am an ordered list, nested in an unordered list
  1. Notice how I can still use 1. on every item too
- I am list item three
- I am list item four
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/ExzwYGj/8d25973684b534347aaac4988ce07799">Markdown lists</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<h2>HTML elements are supported too</h2>
<p>Lastly, you can write good ol’ fashioned HTML in Markdown! For example, you <em>could</em> <a href="https://www.markdownguide.org/extended-syntax/#tables">compose a table with Markdown</a>, but maintaining that would be a <em>nightmare</em>.</p>
<p>An easier way is to render a HTML table element instead:</p>
<pre><code>## A level 2 heading 

Some paragraph text with *emphasis* and **bold**. 

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Month&lt;/th&gt;
      &lt;th&gt;Savings&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;January&lt;/td&gt;
      &lt;td&gt;$250&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;February&lt;/td&gt;
      &lt;td&gt;$80&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;March&lt;/td&gt;
      &lt;td&gt;$420&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/JjqrPxX/96597a7a76753d216a00d19417500b18">Markdown HTML elements</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
<div><h2>FYI</h2>
<p>One thing to be careful about with HTML in Markdown is that applying the features we learned earlier won’t work <strong>inside the HTML</strong>. For example, let’s say you manually make a paragraph, but want some bold text in there:</p>
<pre><code>&lt;p&gt;If I add **bold text, it will not work**.&lt;/p&gt;
</code></pre>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/qBGPWva/1a3ffb2381ae0206fb7704bfc5362c5a">Markdown HTML elements with inline markdown not working</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
</div>
<h2>Wrapping up</h2>
<p>We’ve only just scratched the surface with Markdown here, but that level of knowledge should support the vast majority of people wanting to work with Markdown in their content.</p>
<p>Learning Markdown has so many benefits too. It’ll make you more efficient in <a href="https://www.notion.so/help/writing-and-editing-basics">Notion</a>, <a href="https://slack.com/intl/en-gb/help/articles/202288908-Format-your-messages">Slack</a> and <a href="https://support.atlassian.com/trello/docs/how-to-format-your-text-in-trello/">Trello</a> to name just a few services that support Markdown syntax.</p>
<p>You can go much deeper by reading up on the following links, but if you’ve been sent this link as a quick reference, just keep enjoying the simple — yet powerful — benefits of Markdown!</p>
<h2>Further reading</h2>
<ul>
<li><a href="https://www.Markdownguide.org/extended-syntax/">Extended Markdown syntax</a></li>
<li><a href="https://mdxjs.com/">MDX</a>. MDX powers this and all posts on Piccalilli!</li>
<li><a href="https://masteringMarkdown.com/">Mastering Markdown</a>. A free 10 part video course by <a href="https://wesbos.com/">Wes Bos</a>.</li>
<li><a href="https://gist.github.com/vimtaai/99f8c89e7d3d02a362117284684baa0f">A comparison of syntax extensions in Markdown flavors</a></li>
<li><a href="https://www.markdownguide.org/getting-started/">A more comprehensive guide</a></li>
</ul>
<h2>Playground</h2>
<p>Thanks to our friends at <a href="https://codepen.io">CodePen</a> — who's pen editor supports markdown — here's a handy, <strong>editable</strong> playground that you can practice what you’ve learned in this guide.</p>
<p></p><p>See the Pen <a href="https://codepen.io/piccalilli/pen/JjqrjeM">Markdown playground</a> by Andy Bell (<a href="https://codepen.io/piccalilli/">@piccalilli</a>) on <a href="https://codepen.io">CodePen</a>.</p><p></p>
        
        ]]></description>
        
      </item>
    
      <item>
        <title>What are design tokens?</title>
        <link>https://piccalil.li/blog/what-are-design-tokens/?ref=explainer-category-rss-feed</link>
        <dc:creator><![CDATA[Andy Bell]]></dc:creator>
        <pubDate>Tue, 17 Nov 2020 00:00:00 GMT</pubDate>
        <guid isPermaLink="true">https://piccalil.li/blog/what-are-design-tokens/?ref=explainer-category-rss-feed</guid>
        <description><![CDATA[<p>Design tokens are an extremely <em>hot term</em> that folks brandish around without much of an explanation. I am guilty of doing exactly that, so to hopefully remedy that, here is a tutorial on what they are, how they work and how they are <em>really useful</em>.</p>
<h2>Design tokens, explained by the creator</h2>
<p>I <em>always</em> reference this quote by <a href="https://twitter.com/jina">Jina</a>, who created design tokens, while they were working on the legendary <a href="https://www.lightningdesignsystem.com/">Lightning Design System</a>:</p>
<blockquote>
<p>“Design Tokens are the visual atoms of the design system – specifically, they are named entities that store visual design attributes. We use them in place of hard–coded values in order to maintain a scalable and consistent visual system.”</p>
</blockquote>
<p>It was Jina’s work on this that enabled me to communicate to the team I was in at the time about how I wanted to work on our multi-platform system. I called it a “style guide” at the time—thanks to my background in more traditional print design—but Design System with Design Tokens made much more sense.</p>
<h2>Design tokens, explained by me</h2>
<p>Let’s say your company has a website, an iPhone app and several printed brochures of information. For everything brand-related you use a <a href="https://brandingstyleguides.com/">style guide</a>—that’s pretty darn standard, but that style guide is often a PDF with <em>loads</em> of information that doesn’t mean much to a developer.</p>
<p>That style guide will contain information such as brand colours, typography and how to use the logo—to name just a few examples—but getting that information to technical people who are not well versed in reading style guides could be very risky.</p>
<p>This is where design tokens become <em>really</em> useful because in essence, they are centralised data—almost like a database of design values—that could be consumed by anything that understands a standard, like JSON.</p>
<p>Here, let me show you how design tokens can look when they are in a standard data format, JSON:</p>
<pre><code>{
  "colors": {
    "dark": "#121111",
    "light": "#f8f8f8",
    "primary": "#fdd110",
    "secondary": "#ea1c5c",
    "secondary-shade": "#da0044",
    "tertiary": "#55dde0"
  },
  "fonts": {
    "base": "Helvetica Neue",
    "serif": "Georgia"
  },
  "sizes": {
    "300": 10,
    "400": 16,
    "500": 20,
    "600": 25,
    "700": 31,
    "800": 39,
    "900": 48
  }
}
</code></pre>
<p>Here, the design tokens reference colours, fonts and a size scale. The colours are hex values and the size scale refers to pixel values.</p>
<p>This data would need to be translated per platform. For example: for print, you might need to translate those pixels into points and the hex values to CMYK values. For web, you would probably want to change the pixels to responsive units, like rems or ems, but that’s cool because there’s plenty of tools to do those sorts of translations. The important thing is that we have a centralised structure of definitions that can be used, cross-platform.</p>
<p>Here’s an example of the output if that JSON is converted into Sass:</p>
<pre><code>$colors: (
  'dark': #121111,
  'light': #f8f8f8,
  'primary': #fdd110,
  'secondary': #ea1c5c,
  'secondary-shade': #da0044,
  'tertiary': #55dde0
);

$fonts: (
  'base': '"Helvetica Neue"',
  'serif': 'Georgia'
);

$size-scale: (
  '300': 0.63rem,
  '400': 1rem,
  '500': 1.25rem,
  '600': 1.56rem,
  '700': 1.94rem,
  '800': 2.44rem,
  '900': 3rem
);
</code></pre>
<h2>Maintaining tokens</h2>
<p>We’ve had a look at what the output of design tokens can be, but how are they maintained? As with anything in design and tech: <em>it depends</em>.</p>
<p>Tools such as Figma and Sketch offer a few options when it comes to design tokens. With Figma, there’s plugins such as <a href="https://www.figma.com/resources/extensions-and-apis/figgo/">Figgo</a> which help convert static design tokens into more useful data that developers can use.</p>
<p>With Sketch, you can use plugins such as the handily named, <a href="https://github.com/design-meets-development/design-tokens-plugin">Design Tokens Plugin</a>.</p>
<p>More technical tools include <a href="https://github.com/salesforce-ux/theo">Theo</a>, by the Salesforce team, which is a popular choice amongst large design systems. There’s also tools such as <a href="https://amzn.github.io/style-dictionary/">Style Dictionary</a>, which again, suits larger systems. Heck, you can even maintain design tokens with a handy <a href="https://github.com/kaelig/google-spreadsheets-theo-demo">Google Sheet and Theo</a>.</p>
<p>There’s promising looking tools such as <a href="https://www.usearcade.com/">Arcade</a> by the fine folks (and design systems experts) at SuperFriendly, too.</p>
<p>It would also be daft of me to not feature my own tools, <a href="https://github.com/hankchizljaw/gorko">Gorko</a> and <a href="https://github.com/hankchizljaw/goron">Goron</a> which turn design token data into CSS and/or SCSS.</p>
<h2>Wrapping up</h2>
<p>I hope this quick explainer of what design tokens are helps you to understand them more.</p>
<p>I’d also urge you to <a href="https://css-tricks.com/what-are-design-tokens/">read this article on CSS-Tricks</a>, look through this <a href="https://noti.st/sturobson/H9SeXk/design-tokens-and-css-systemising-the-design-of-components">speaker deck by Stu Robson</a> and finally, <a href="https://www.youtube.com/watch?v=wDBEc3dJJV8">watch this video with the creator of design tokens themselves, Jina, and a colleague</a>.</p>
<p>Until next time,
Take it easy 👋</p>
        
        ]]></description>
        
      </item>
    
    </channel>
  </rss>
