The Publishing Project

Git: Adding a remote parent to a forked repository

Git allows developers to fork and clone repositories. The main difference between the two commands is that when you clone a repository you create an exact copy of the “main” repository, to which you’re not likely to have access or permissions to make changes. However, when you fork a repository, you create a copy that you own and you can update and get ready for pull requests. Forking introduces a problem into the equation, do you see? Because forking creates your own copy of the repository, it is no longer updated from the original. Whatever changes you make are exclusive

Javascript Dynamic Imports

There is a function-like, dynamic form of import that will allow us to play with imports inside modules and classes and will let us work with them together with async functions and awaiting for async events to complete instead of using then/catch blocks for our promise-based async code. <script type=”module”> (async () => { try { const utilsModuleSpecifier = ‘./utils.js’; const utilsModule = await import(utilsModuleSpecifier) utilsModule.default(); utilsModule.doStuff(); } catch { console.log(‘Dynamic import failed’); } })(); </script> Modules (either dynamic or static) use defer by default. ES6 modules run in strict mode, even if you don’t write “use strict”; in them.

Exploring Typescript: Notes about the language as I learn it

Typescript is good to usee but at times it can be really infuriating to learn how to use it and to use it properly. When you bring in Javascript files to convert to Typescript it will give you many surprises and not all of them are intuitive or easy to decipher. It’s important to remember that while Typescript will transpile to Javascript it’s a superset of the ECMAScript specification, and you need to learn the differences. These are not all the things I’ve learned but they are the most important to me. When to add types and when to let

Exploring Typescript: Setting up the tools

Typescript is an interesting language. It’s a typed superset of Javascript that you can compile to usable Javascript, either ES5 or later yearly versions of the language. Because it’s not straight Javascript it requires compilation before it can be used in Node or browsers. Using built-in tools to work with Typescript The easiest way to use Typescript is to install the tool themselves and then run them through NPM scripts we set up in package.json. Compiling To compile Typescript we need the Typescript compiler (TSC) that comes bundled with the NPM typescript package. To install it run the following command.

Picture deep dive

When I first looked at responsive images I thought that srcset and sizes would be enough to handle most of my responsive images needs. See Concepts and examples of responsive images and How To Use Responsive Images for reference but notice that I barely touched on <picture> at all in either of those articles. When researching how to leverage new image formats in the context of HEIF and AVIF, I discovered that we needed to leverage the other part of the responsive images specification: the picture element. The picture element has more applications that srcset and sizes. We will explore