<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vincent Liao</title>
    <description>The latest articles on DEV Community by Vincent Liao (@vinliao).</description>
    <link>https://dev.to/vinliao</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F173406%2F720104c9-f963-4c9e-993c-3eb754565a58.jpg</url>
      <title>DEV Community: Vincent Liao</title>
      <link>https://dev.to/vinliao</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinliao"/>
    <language>en</language>
    <item>
      <title>Show Dev: A Hugo Theme That Feels Like a Milligram</title>
      <dc:creator>Vincent Liao</dc:creator>
      <pubDate>Sat, 13 Mar 2021 03:44:27 +0000</pubDate>
      <link>https://dev.to/vinliao/show-dev-a-hugo-theme-that-feels-like-a-milligram-52bg</link>
      <guid>https://dev.to/vinliao/show-dev-a-hugo-theme-that-feels-like-a-milligram-52bg</guid>
      <description>&lt;p&gt;No hugo theme out there satisfied my itch, so I had to build it myself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oc2HsXIZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/vinliao/mita/master/images/mita-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oc2HsXIZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/vinliao/mita/master/images/mita-1.png" alt="mita first"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZS-EyJUo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/vinliao/mita/master/images/mita-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZS-EyJUo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/vinliao/mita/master/images/mita-2.png" alt="mita second"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For demo, you can go &lt;a href="https://vinliao.com"&gt;https://vinliao.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For github repo, &lt;a href="https://github.com/vinliao/mita"&gt;https://github.com/vinliao/mita&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How To Combine Fonts (Hint: Contrast)</title>
      <dc:creator>Vincent Liao</dc:creator>
      <pubDate>Tue, 02 Mar 2021 16:26:06 +0000</pubDate>
      <link>https://dev.to/vinliao/how-to-combine-fonts-hint-contrast-3mic</link>
      <guid>https://dev.to/vinliao/how-to-combine-fonts-hint-contrast-3mic</guid>
      <description>&lt;p&gt;Contrast attracts the eye, and you can use fonts to create contrast in your design.&lt;/p&gt;

&lt;p&gt;Take a look at this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HLbYA_K0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hc9q4zpbd6dep3igsxbn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HLbYA_K0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hc9q4zpbd6dep3igsxbn.png" alt="Third image of font"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The example on the right is more “colorful” in a way that doesn’t utilize color. It’s interesting without overwhelming the eye.&lt;/p&gt;

&lt;p&gt;Here are other examples.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KGvP2-_l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/247tsk6zgmoypoam16vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KGvP2-_l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/247tsk6zgmoypoam16vk.png" alt="Second image of font"&gt;&lt;/a&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T2PzgIu7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1t8lntkgbdetep6dtxqk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T2PzgIu7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1t8lntkgbdetep6dtxqk.png" alt="Fourth image of font"&gt;&lt;/a&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aNfhYZRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84o7vt9bq1lslzrobnks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aNfhYZRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84o7vt9bq1lslzrobnks.png" alt="Fifth image of font"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s all about contrast—the more different the typeface or font is, the more interesting it becomes. There is, obviously, a fine line—when the fonts clashes really hard, it’s becomes confusing rather than interesting. &lt;/p&gt;

&lt;p&gt;If you combine all the things above, it will look something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cM09c9t1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nezejl1v22oatu8o5y3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cM09c9t1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nezejl1v22oatu8o5y3n.png" alt="First image of font"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to add another font to your single-font design in your website, there’s no point in adding a font that looks similar. At best, it will look like a design without conflict, but it confuses the eye when inappropriately applied.&lt;/p&gt;

&lt;p&gt;Contrast attracts the eye; to create contrast, you can't be a wimp.&lt;/p&gt;

</description>
      <category>design</category>
      <category>css</category>
    </item>
    <item>
      <title>Show Dev: A VSCode Snippet to Write JS Arrow Function Really Fast</title>
      <dc:creator>Vincent Liao</dc:creator>
      <pubDate>Sat, 27 Feb 2021 18:02:30 +0000</pubDate>
      <link>https://dev.to/vinliao/show-dev-a-vscode-snippet-to-write-arrow-function-really-fast-da1</link>
      <guid>https://dev.to/vinliao/show-dev-a-vscode-snippet-to-write-arrow-function-really-fast-da1</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/vinliao/fast-arrow"&gt;https://github.com/vinliao/fast-arrow&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lMkP8e4h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://raw.githubusercontent.com/vinliao/fast-arrow/master/images/faster.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lMkP8e4h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://raw.githubusercontent.com/vinliao/fast-arrow/master/images/faster.gif" alt="gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was quite annoyed for having to type arrow functions in js. So much keypresses! Now I use this all the time when writing arrow functions.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>vscode</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Create Your Own Hugo Theme From Scratch—With Snails</title>
      <dc:creator>Vincent Liao</dc:creator>
      <pubDate>Sat, 27 Feb 2021 04:51:49 +0000</pubDate>
      <link>https://dev.to/vinliao/create-your-own-hugo-theme-from-scratch-5df9</link>
      <guid>https://dev.to/vinliao/create-your-own-hugo-theme-from-scratch-5df9</guid>
      <description>&lt;p&gt;Okay, you’ve tried hugo. It’s nice, it’s fast; it’s what the cool kids use. You shuffle from theme to theme and found nothing you like for your beloved blog.&lt;/p&gt;

&lt;p&gt;What do you do?&lt;/p&gt;

&lt;p&gt;That’s where I was in a month ago, and I created my own hugo theme from scratch. In this post, I’ll outline everything I did.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;p&gt;Here’s what you need to know before proceeding.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML and templating engine (e.g., Jinja, handlebars, liquid, etc)&lt;/li&gt;
&lt;li&gt;little bit of hugo&lt;/li&gt;
&lt;li&gt;terminal (&lt;code&gt;cd&lt;/code&gt;, &lt;code&gt;rm&lt;/code&gt;, etc)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright, let’s dive straight to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a new hugo site for the “shell”
&lt;/h2&gt;

&lt;p&gt;This is the one confusion that has wasted hours of my life.&lt;/p&gt;

&lt;p&gt;The theme you create must live inside a hugo site. Think of a snail—the theme is the slimy part, and the thing for testing your theme is the shell part.&lt;/p&gt;

&lt;p&gt;This is how it looks like in “trees.”&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
└── site (shell of snail)
    ├── blahblahblah
    ├── content
    └── themes
        └── your-theme (the slimy part)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Time to create
&lt;/h3&gt;

&lt;p&gt;In the directory of your choice, run &lt;code&gt;hugo new site your-site-name&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The directory will look like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── archetypes
│   └── default.md
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the &lt;code&gt;themes&lt;/code&gt; folder? Yeah, those are the folders we’re going to mess with.&lt;/p&gt;

&lt;p&gt;What you have to do now is to create a new theme in that folder. You can do that with &lt;code&gt;hugo new theme your-theme-name&lt;/code&gt;, but for me, that’s too barebones. Here’s what I did to get up and running ASAP.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;cd to &lt;code&gt;themes&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git clone https://github.com/vinliao/hugo-starter.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rm -rf hugo-starter/.git&lt;/code&gt; to remove git (so you can point to your own git remote)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mv hugo-starter your-new-theme-name&lt;/code&gt; to rename&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cd ../..&lt;/code&gt; and in config.toml, add &lt;code&gt;themes = "your-new-theme-name"&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now it looks—more or less—like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── archetypes
│   └── default.md
├── config.toml
├── content
├── data
├── layouts
├── resources
│   └── _gen
│       ├── assets
│       └── images
├── static
└── themes
    └── your-new-theme-name
        ├── archetypes
        │   └── default.md
        ├── exampleSite
        │   └── config.toml
        ├── layouts
        │   ├── 404.html
        │   ├── _default
        │   │   ├── list.html
        │   │   └── single.html
        │   ├── index.html
        │   └── partials
        │       ├── footer.html
        │       ├── header.html
        │       └── nav.html
        ├── README.md
        └── static
            └── css
                └── style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;cd&lt;/code&gt; to the root of this site—read: the “shell” of the snail—and run &lt;code&gt;hugo serve -D&lt;/code&gt;. (The -D arg is for showing drafts).&lt;/p&gt;

&lt;p&gt;Boom. It’s working... but it’s empty. To fill the emptiness, you can use the &lt;code&gt;hugo new your-post-name.md&lt;/code&gt; command. &lt;/p&gt;

&lt;p&gt;Try it out—run &lt;code&gt;hugo new about.md&lt;/code&gt;, then &lt;code&gt;hugo serve -D&lt;/code&gt;, and go to &lt;code&gt;localhost:1313/about&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Theme details
&lt;/h2&gt;

&lt;p&gt;I won’t get into the nitty gritty, but I’ll just explain the very basics of hugo templating engine—ELI5 fashion.&lt;/p&gt;

&lt;p&gt;If you go to your theme folder—the slimy part of the snail—here’s what you’ll see.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── archetypes
│   └── default.md
├── exampleSite
│   └── config.toml
├── layouts
│   ├── 404.html
│   ├── _default
│   │   ├── list.html
│   │   └── single.html
│   ├── index.html
│   └── partials
│       ├── footer.html
│       ├── header.html
│       └── nav.html
├── README.md
└── static
    └── css
        └── style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The most important folder is the layouts folder. At this stage, you can pretty much ignore everything else. Let’s zoom in there, shall we?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── 404.html
├── _default
│   ├── list.html
│   └── single.html
├── index.html
└── partials
    ├── footer.html
    ├── header.html
    └── nav.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How does all these relate to each other?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;404.html&lt;/code&gt; is self-explanatory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;nav.html&lt;/code&gt;, &lt;code&gt;header.html&lt;/code&gt;, and &lt;code&gt;footer.html&lt;/code&gt; is also self-explanatory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;header.html&lt;/code&gt; contains &lt;code&gt;nav.html&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.html&lt;/code&gt; contains &lt;code&gt;header.html&lt;/code&gt; and &lt;code&gt;footer.html&lt;/code&gt;. This is the thing that gets “served” when user visits &lt;code&gt;yourwebsite.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list.html&lt;/code&gt; contains &lt;code&gt;header.html&lt;/code&gt;. This is the thing that gets served when user views &lt;code&gt;yourwebsite.com/posts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;single.html&lt;/code&gt; serves individual post&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Another way to see this: &lt;code&gt;list.html&lt;/code&gt; is like the list of things that gets shown to you when you first open Hacker News; &lt;code&gt;single.html&lt;/code&gt; is for HN comments.)&lt;/p&gt;

&lt;p&gt;Here’s something that caught me offguard about all these files: the &lt;code&gt;header.html&lt;/code&gt; and &lt;code&gt;footer.html&lt;/code&gt; are, in the end, combined into one file. If you look at &lt;code&gt;header.html&lt;/code&gt;, you notice that there’s an opening tag for &lt;code&gt;&amp;lt;main&amp;gt;, and &amp;lt;body&amp;gt;&lt;/code&gt;, but no closing tag. Ding, ding, ding—the closing tag is on &lt;code&gt;footer.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This structure is not a straitjacket rule. The theme I created (&lt;a href="https://github.com/vinliao/mita"&gt;https://github.com/vinliao/mita&lt;/a&gt;) doesn’t adhere to this structure. In my theme, I want the list of post to show when user visits &lt;code&gt;vinliao.com&lt;/code&gt; instead of having to go to &lt;code&gt;vinliao.com/posts&lt;/code&gt;. I ended up changing the &lt;code&gt;index.html&lt;/code&gt; to show lists of post instead.&lt;/p&gt;

&lt;p&gt;Now that you understand, you can do whatever you want with your theme.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git
&lt;/h2&gt;

&lt;p&gt;If you want to share this theme, share the slimy part, not the whole snail.&lt;/p&gt;

&lt;p&gt;This means you must &lt;code&gt;git init&lt;/code&gt; in the &lt;code&gt;your-theme-name&lt;/code&gt; folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This is not an in-depth post in any way, but at least, you can now fiddle with your theme.&lt;/p&gt;

&lt;p&gt;Happy hacking, people of the internet!&lt;/p&gt;

</description>
      <category>hugo</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
