Skip to main content
CSS is fun and cool and I like it.
Article

HTML Templates via JavaScript Template Literals

You know those super cool backticks-for-strings in new JavaScript?

let emotion = `happy`;
let sentence = `Chris is feeling ${emotion}`;

Besides the variable interpolation in there being mighty handy, the do multi-line strings wonderfully, making them great for chunks of HTML:

const some_html = `
  <div class="module">
    <h2>${data.title}</h2>
    <p>${data.content}</p>
  </div>
`;
Read article
Article

Four Killer Features of Nunjucks

Nunjucks calls itself "A rich and powerful templating language for JavaScript", which sounds about right. It's not intentionally super lightweight like Mustache or the slightly more robust (but still pretty light) Handlebars. It's a full-on language, packed with all kinds of stuff you might want when writing templates.

You can run it in the browser, but you probably shouldn't. This is meant to be run in Node.js and used to compile templates server side.

In other words: it's a … Read article

Article

Getting Started with CSS Modules

There isn't one single approach with CSS Modules to making the JavaScript templates, the CSS files, or the build steps to make them work. In this post, which is part of a series on CSS Modules, we'll look at one approach. The goal of this post is to get a CSS Modules project up and running.

Article Series:

  1. What are CSS Modules and why do we need them?
  2. Getting Started with CSS Modules (You are here!)
  3. React + CSS Modules
Read article
icon-link icon-logo-star icon-search icon-star