Dublin Library

The Publishing project

Starting a new Node Project

Most of the time, starting a Node project involves a lot of typing, copying and pasting and typing data into your repository. This post lists some ways to automate the process in the command line and via scripts. Thanks to Phil Nashhttps://twitter.com/philnash and Tienery Cyrenhttps://twitter.com/bitandbang for the information. : How to start any new Node.js project:$ npx license mit > LICENSE$ npx gitignore node$ npx covgen YOUREMAILADDRESS$ npm init -yYou're ready to start coding.— Tierney Cyren @bitandbang January 7, 2019 npx license mit uses the license packagehttps://www.npmjs.com/package/license to download a license of your choice for the project, in this case,...

Continue reading →

Improving Font Performance: Work to control font loading

Because of their size fonts tend to be some of the largest components of any web pages. According to the HTTP Archive, the sum of the transfer size of all fonts eot, ttf, woff, woff2, or otf requested by the page is 98KB for Desktop and 83.4KB for mobile. There are several CSS and Javascript techniques to help browsers control and speed up font display and how it swaps when the web font is loaded. The idea is to load the page as quickly as possible using fallback fonts and then swap the web font in when it's ready. Use...

Continue reading →

Improving Font Performance: Use Resource Hints

If you're using a third party font service like Google Fonts or Typekit you should work on mitigating potential latency. Say you have a typical Google Font embed code in your <head>. You could minimize the amount of time it takes to connect with that server using the preconnecthttps://w3c.github.io/resource-hints/preconnect resource hint. These hints will not load the resource but will do a DNS lookup for the host, TCP handshake, and optional TLS negotiation, all before the resource is actually requested. html A more widely compatible alternative to preconnect is dns-prefetch. It won’t establish a connection to the server, but it...

Continue reading →

Improving Font Performance: CDNs and Service Workers

Serve through a Specialized CDN Serving content through a CDN has always been a key to improve performance. The edge servers are in diverse geographical locations and they will route users to the closest server to their location. Serving fonts through a CDN is no different. Sites like Adobe Fontshttps://fonts.adobe.com/ formally known as Typekit and Google Fontshttps://fonts.google.com/ provide a faster experience downloading the fonts to your devices. Combine the CDN service with preconnect or dns-fetch resource hints for an even faster experience. Cache fonts using a service worker Most of the time when we hear about Service Workers we hear...

Continue reading →

Improving Font Performance: Subset fonts using Glyphhanger

Glyphhangerhttps://github.com/filamentgroup/glyphhanger is a Node application that will help you reduce the size of your fonts by subsetting them. There are times when we use just a few characters from a given font. For example, if we use a font just for headings there are many characters that you will not use, a subset will get rid of these unnecessary characters making the fonts smaller and providing a faster download. Another example is when the font supports multiple languages that you know you won't need for your project like Cyrillic when you know you will be working with English, Spanish, and...

Continue reading →

Improving Font Performance: Introduction and the bulletproof syntax

Talking about web font performance is more than just talking about adding the fonts to a page using @font-face. That's just the beginning of our quest for performant fonts. Because of their size fonts tend to be some of the largest components of any web pages. According to the HTTP Archive, the median of requested fonts is 98KB for Desktop and 83.4KB for mobile. !Comparison of median font sizes from 2010 to todayhttps://res.cloudinary.com/dfh6ihzvj/image/upload/cscale,w500/fauto,qauto/font-bytes Making our fonts performant is particularly important when working with large variable fonts; Roboto VFhttps://github.com/TypeNetwork/Roboto is 976KB when compressed with WOFF2 and, if not cached, can significantly...

Continue reading →

Don't cross the streams

Streams are a very interesting concept and a new set of tools for the web. The idea is that we can read and write, depending on the type of stream we're using, chunks of content... either write them to a location or read them from a location. This will improve performance because we can start showing things to the user before it has completed loading. The example below how we can asynchronously download and display content to the user. The problem with this, if you can call it that, is that fetch will wait to download the entire file before...

Continue reading →

Playing with typography

If you don't know I have a ton of different type and layout experiments in their own websitehttps://web-layout-experiments.firebaseapp.com/. I'll start sharing some of the demos I've been working on via Twitter and explain the code for some here. The full demo is available in Codepenhttps://codepen.io/caraya/pen/MZVbLz. The HTML The HTML is as simple as it comes. It's an h1 heading element inside a container div. We will use the container to place the title and the myTitle heading as the target for lettering.js html Nightfall This example uses only the heading. We could add more text and assume that this is...

Continue reading →

Working With Opaque Responses

While working with Workbox I discovered a hidden danger of opaque responses. This post will address these shortcomings and provide an imperfect solution for how to do it. Normally, opaque responses are not cacheable along with additional restrictions. See Jeff Posnick's Stack Overflow Answerhttps://stackoverflow.com/questions/39109789/what-limitations-apply-to-opaque-responses for details but it boils down to the following items: - Because opaque responses are meant to be a black-box you won't get meaningful information from most of the properties of the Response class, or call the various methods that make up the Body interface, like json or text - Browsers pad the opaque resource size....

Continue reading →

Progressive Enhancement Matters

> Progressive Enhancement is a powerful methodology that allows Web developers to concentrate on building the best possible websites while balancing the issues inherent in those websites being accessed by multiple unknown user-agents. Progressive Enhancement PE is the principle of starting with a rock-solid foundation and then adding enhancements to it if you know certain visiting user-agents can handle the improved experience. PE differs from Graceful Degradation GD in that GD is the journey from complexity to simplicity, whereas PE is the journey from simplicity to complexity. PE is considered a better methodology than GD because it tends to cover...

Continue reading →