Dublin Library

The Publishing project

Working with local fonts

Web fonts are awesome but there are times when they are not enough. There may be foundries that don't provide web versions of their fonts or licenses to use their fonts on the web. Chromium browsers now have the choice of using local fonts for your web projects. This will allow users to take full advantage of the fonts they own for their projects without violating licenses or other potential legal issues. Feature detection Since the feature is only supported in Chrome and Edge but not on other Chromium Browser like Opera or Samsung Internet, Firefox or Safari, we need...

Continue reading →

Color tools and experiments - Color Converter

The more I play with color.jshttps://colorjs.io, the more I love it. I created two simple tools on top of it to make my life easier. The first one is a color converte. This post will discuss why I created it and how it works. The tools I've built each tool as a separate Vitehttps://vitejs.dev/ project to make sure I got them working. A future iteration of this project will combine them into a single project. The future version will also move to Typescript as I become more comfortable with types and the Typescript extensions to Javascript. Color conversion The first...

Continue reading →

Custom List Styles in CSS

CSS lists look nice with the standard list styles but there are cases when we may want to use special characters in the styles, the language that we use may have special, or we may just want to have fun. To modify the appearance of lists we'll look at the list-style-typehttps://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type property and the @counter-stylehttps://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style at-rule. list-style-type list-style-type lets CSS authors select from a list of available list styles to use. THe list of available values for both ordered and unordered lists is in the MDN pagehttps://developer.mozilla.org/en-US/docs/Web/CSS/list-style-typevalues We'll use the values on that list to create custom ordered and unordered...

Continue reading →

Javascript events

When working on a demo for a different post, I realised that I don't really know how events work beyond how to add them to the page. This post will look at events and events listeners, how to add them to the page and additional information that may be useful when working with events. What are events? The Eventhttps://developer.mozilla.org/en-US/docs/Web/API/Event API represents an event that happens in the DOM. See MDN's Event referencehttps://developer.mozilla.org/en-US/docs/Web/Events page for a list of the different types of events that are available. Handling events Browsers generate events all the time. When you move the mouse or tab...

Continue reading →

Programmatically manipulating CSS classes

When working with Javascript there will be times when we need to change the CSS we apply to the web pages we're working on. Javascript provides two methods to manipulate an HTML element's classes: classNamehttps://developer.mozilla.org/en-US/docs/Web/API/Element/className and classListhttps://developer.mozilla.org/en-US/docs/Web/API/Element/classList. For this post we'll concentrate in classList since it provides methods to manipulate the class attribute and it avoids the string manipulation that you'd have to do when working with className. classList is a read-only property that returns a live space-separated list of the class attributes of the element that we can manipulate using classList methods The classList methods are: addhttps://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add : Adds...

Continue reading →

Node native .env support

Starting in Node 20.6.0https://nodejs.org/en/blog/release/v20.6.0 there is built-in support for loading environment variables from a .env file into process.envhttps://nodejs.org/docs/latest/api/process.htmlprocessprocessenv as recommended in The Twelve-Factor Apphttp://12factor.net/config methodology. In this post we'll talk about .env, what it is, why use it, and how it works in Node. What is .env file and why use it? An .env file contains all configuration files for your application like passwords, API keys and other potentially sensitive information. The idea comes from the Twelve-Factor App Methodologyhttps://12factor.net/ that suggest that we store config in environment variables. These environment variables are easy to change and they won't be checked...

Continue reading →

Testing Footnotes

I can use Google Earth Web and get the satellite image. I can’t get detailed resolution and the satellite image I get doesn’t show anything about the current war on either side. If it has been disabled, do you know who asked Google to disable satellite imagery? You’re assuming it was Google’s decision when it might not have been. ^1 Unclassified or commercial satellite imagery is not good enough for you to be able to see what’s going on in the ground, it is also very expensive. You’d need aircraft-generated imagery to get to high-resolution images. The reasons why that...

Continue reading →

Updates to @font-face (part 2) (2023)

@font-face has been around for a while and it works fine for the existing monochrome, one file per style fonts that we've been using so far. CSS Fonts level 4https://w3c.github.io/csswg-drafts/css-fonts/ introduced two new properties to the src attribute the of @font-face at-rule. These attributes are tech and format. We will discuss each of these in turn. format This attribute specifies the font format of the font it is attached to. If the value for format is not supported or invalid, the browser will not download the resource, potentially saving bandwidth and improving performance. If omitted, the browser will always download...

Continue reading →

Updates to @font-face (2023)

With new CSS technologies, it's good to look at new or updates descriptors inside the @font-face at-rule. font-weight, font-style and font-stretch font-weight,font-style, and font-stretch can now take one or two values. font-weighthttps://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight and font-stretchhttps://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch can take two values to represent the lower and upper boundaries of the variable font range for the descriptor. font-stylehttps://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style can also use ranges but it's a little more complex than font-weight and font-stretch. The possible values for the descriptor are: normal : Selects the normal version of the font-family : If you use this value then it must be the only value for font-style italic...

Continue reading →

Variable viewport units

We're used to a set of viewport units that represent the size of the browser's viewport. vw: 1% of the width of the viewport size vh: 1% of the height of the viewport size vmin: the smaller of vw or vh vmax: the larger of vw or vh The existing viewport units deal with physical properties. In this post we will look at the new variable units, how they would work and why they are necessary when working in mobile. New viewport units for mobile Give an element a width of 100vw and a height of 100vh, and it will...

Continue reading →