5 Tagged | code

Share Controls Web Component

I built a Web Component that adds native copy to clipboard and sharing controls to a web page. The original idea was based on this excellent blog post by the folks at Set Studio. In this post I don't really want to go into the technical details of …

Continue reading →

My notes on Eleventy WebC components

The WebC plugin brings a component model similar to frameworks like Vue and Svelte to Eleventy. It allows you to create HTML-only components (basically includes) all the way up to interactive Web Components with shadow DOM and all the benefits it …

Continue reading →

Wrap element snippet

I've found myself needing to do this on a couple of projects lately so it seemed like a good idea to write it down here as a snippet to reference later. This sort of a vanilla replacement for jQuery's .wrap() method /** * Helper function to wrap one …

Continue reading →

Visually hidden snippet

There are several ways to hide content using CSS. For example using display: none, or visibility: hidden. Each way of hiding elements is useful in different situations, but this snippet is specifically for visually hiding elements while keeping the …

Continue reading →

Copyright Snippet

It's that time of year again, so I thought I'd do a quick post on the simple bit of JavaScript I use to keep the copyright date current in the static sites I build. Add the hidden attribute to your container element markup so that if JS fails for …

Continue reading →