I love NVM. It allows me to keep multiple versions of Node installed and available to run as needed for testing and development. However, it is not free of problems and footguns. Some packages are version specific and will crash if you're running a different version looking at you, SASS and others are compiled against specific Node versions. I saw this happen with a package from libsquoosh, my image manipulation tool of choice, so I decided to take a look at how to switch versions to a specific one when changing directories. The first step is to create a .nvmrc...
There are some very interesting things you can do with SVG and, more recently, with CSS to manipulate the way text looks on screen. This post will explore how to do text on a path using SVG and CSS, some of the difficulties and what we can do with the technology We will also look at how to animate text on a path. Text in a path !Example of text on a pathhttps://res.cloudinary.com/dfh6ihzvj/image/upload/cscale,w500/fauto,qauto/text-on-a-path-svg Figure 1 shows a basic example of text on a path. This is what we want to emulate. SVG SVG is the easier way to create text...
One of the coolest things I see in tutorials and demos is the automatic reload when files change. This post will explore three ways of setting auto-reload for your front-end projects. These three projects will start from scratch. Integrating tooling into an existing project is not trivial and will depend a lot on your skills and the type of project you're working on. Vite Vitehttps://vitejs.dev/ created by Evan Yu, the creator of Vue.js, Vite provides a fast and consistent experience: To start a new project with Vite, the command will depend on the version of NPM you're using. If you're...
One of the first things that caught my attention when ES2015 was first released in 2015 were promises. They provide a nice alternative to callbacks and made the code easier for me to reason through. In 2017 TC39 the group in charge of Javascript standardization added async/await, a way to make promise code easier to read and reason through, to the ECMA262 specification, essentially writing promise-based asynchronous code as it was synchronous blocks of code that, as developers, we're already familiar with. The idea sounds simple enough but I always trip on the execution. This post is my attempt at...
The Wakelock API presents a way to prevent devices from dimming or locking the screen when an application needs to keep running. For example: Applications like Art Space Tokyohttps://read.artspacetokyo.com/ would benefit from the browser not going to sleep while using maps to reach the different art spaces and museums discussed in the book. Recipe applications would benefit from the screen not going to sleep while you work on the recipe with dirty hands. Looking at the code We first create a variable to hold the status of the wakeLock request. we default it to null since the request hasn't been...
In previous posts we've looked at the theoryhttps://publishing-project.rivendellweb.net/video-on-the-web-part-1-the-theory/ behind the different formats and codecs you can use for your videos and how to encode videohttps://publishing-project.rivendellweb.net/video-on-the-web-part-2-encoding-video/ for use on the web. This post will cover the HTML necessary to embed a set of theoretical videos that we encoded for the project. 1. MP4 container, AV1 video, and Opus audio 2. WebM container, VP9 video, and Opus audio 3. MP4 container, x264 video, and AAC audio 4. OGG container, OGG video, and Vorbis audio Building the element The basic element embeds and plays video a single version of the video. It also...
In Video on the web part 1: The theoryhttps://publishing-project.rivendellweb.net/video-on-the-web-part-1-the-theory/ we discussed the theory of video on the web, what containers, audio and video codecs are available and what browsers support them. This post will discuss more practical aspects of creating and using video on the web. A follow up post will discuss using the element to embed videos on web pages. This post will not cover DASH or HLS videos. Encoding the video Once we've decided what container and codecs to use, the next step is to create the video or videos that we will use. To encode the video...
When working with video on the web using the <video> element there is an important detail that many developers and people writing web content forget. MP4, WebM, and AV1 are containers and they can have many different audio and video codecs inside; browsers may not and most likely will not support all audio and video combinations for all containers. I first became aware of this when working with MP4 files. An MP4 container can contain many different codecs for audio and video and browsers may or may not support all those different combinations. WebM containers have the same issue. There...
Intersection observers are native Javascript API that allows developers to trigger events or behaviors when content comes into or goes out of the viewport. I find it particularly interesting as a starting point to do more complex work where we want to wait until the item we're working with becomes visible on screen. For example, if we want all the images on a page to slowly appear as the page is loaded with animations then it makes sense to wait for the individual images to appear in the browser's viewport before we trigger the animation. The process has two components,...
The previous post on why we still need custom CSS in WordPress was getting a little long so I made a second post to cover some additional features that are not available in the Gutenberg editor as of the time this post was written December 2022. It is also good to reiterate that these features are meant for bespoke designs or designs where the features are relevant to the design. Not all sites need alternate character sets with swatches or table numbers. If you find yourself reaching out for these tools for every project, perhaps it's time to rethink whether...