duane blake

How to Add a Custom Font to Your Laravel Project

There may be occasions when you have to use a custom font, such as a brand font, in your Laravel Project. I’m going to go through the steps for adding a custom font to your project.

In this example, I’m using the Laravel Starter kit with Livewire, but it should also work with React and Vue starter kits.

  1. In your Laravel application directory, create a new folder in resources called fonts. Once created, add your fonts to that folder.
  2. Open the resources/js/app.js file and place the code below. The code makes Vite aware that we have our fonts installed.
import.meta.glob([

'../fonts/**',

]);
  1. We now need to import the font into a stylesheet. In the following file, resources/css/app.css, use the font-face rule and replace FONTNAME with the name of your font.
@font-face {
    font-family: 'FONTNAME';
    src: url('../fonts/FONTNAME.woff2') format('woff2'),
         url('../fonts/FONTNAME.otf') format('otf');
    font-weight: normal;
    font-style: normal;
}
  1. I’m using Tailwindcss with the font installed in our application. We are going to create a new utility for our new font. Under the theme layer where your custom Taillwind settings are saved, add the following.
    --font-FONTNAME: 'FONTNAME', sans-serif;
  1. With that all added, go to your template, add the font to the required selector, and the page will render it correctly.
<h1 class="font-FONTNAME text-3xl">Hello World</h1>

That’s how to add a custom font to a Laravel application If you want to read more about this you go to the Laravel documentation – Processing Static Assets With Vite

Read this article about How to Add a Custom Font to Your Laravel Project

Games I completed in 2024

As we come to the end of the year, I wanted to reflect on some of the games I have completed. This year was a lot different for me, as I usually go back and replay games I completed before. But there is not one game on this list I have completed before. I’m also trying to focus on finishing games from my backlog, as every year, it seems to get bigger and not go down. So, there are quite a few older titles on this list.

Read this article about Games I completed in 2024

How to Update Input Values Dynamically based on another input with Laravel and Livewire

One of the things I love about modern development tools and frameworks is how they make it so easy to do simple features. Years ago, these sorts of things I’m about to show would be some jQuery gymnastic with a prayer that it works in IE. Updating another value based on input in Livewire is a simple process with modern frameworks like Livewire and Laravel.

Livewire mascot

Read this article about How to Update Input Values Dynamically based on another input with Laravel and Livewire