# `bud.asset` font filename hashes (production)

**URL:** https://discourse.roots.io/t/bud-asset-font-filename-hashes-production/24221
**Category:** bud
**Tags:** webpack
**Created:** 2022-11-11T17:35:32Z
**Posts:** 4

## Post 1 by @strarsis — 2022-11-11T17:35:32Z

The filenames processed by `bud.asset` have hashes in their filenames (which is intended and expected).

Using [`theme.json`/`fontFamilies`](https://fullsiteediting.com/lessons/theme-json-typography-options/#using-the-web-fonts-api-with-theme-json) theme-specific fonts can be defined (and loaded using WordPress Web Fonts Loader). The `src` property expects the paths to the font files.

How can those files be correctly referenced, with the hashes included.  
[`bud` can generate a `theme.json` on build](https://bud.js.org/extensions/sage/theme.json/), but the complete `theme.json` be specified with this - or derived from an existing `theme.json` file?  
Notably the `styles` and `templateParts` properties also need to be set (without Tailwind or beyond that).  
Or can the filename hashes be selectively disabled for those font files?

---

## Post 2 by @strarsis — 2023-01-30T11:13:31Z

Using the `setOption` method allows to set `theme.json` options outside of `settings`.  
Example:

```
/**
     * Generate WordPress `theme.json`
     *
     * @note This overwrites `theme.json` on every build.
     *
     * @see {@link https://bud.js.org/extensions/sage/theme.json/}
     * @see {@link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json/}
     */
    .wpjson
      .setOption('templateParts', [
        {
          "name": "header",
          "title": "Narrow header",
          "area": "header"
        },
        {
          "name": "header-large",
          "title": "Large header",
          "area": "header"
        },

        {
          "name": "footer",
          "title": "Footer",
          "area": "footer"
        }
    ])
```

---

## Post 3 by @andronocean — 2024-09-28T23:30:03Z

@strarsis Did you ever find a solution for referencing the hash-named font files in theme.json? I just ran into this and am fairly stumped.

It doesn’t look like Bud has a way to retrieve those filenames during compilation. The correct filenames are in the manifest, but unfortunately WordPress doesn’t seem to have a way to filter the src property it outputs in `@fontface`, either.

---

## Post 4 by @strarsis — 2024-09-29T09:56:51Z

Yes, this is solved by adjusting the font file paths in the `theme.json` as an extra step during `bud` build:

> [@Resolve asset to public path in `bud.config.js`/JavaScript](https://discourse.roots.io/t/resolve-asset-to-public-path-in-bud-config-js-javascript/24679/7):
>
> Thanks @strarsis for your insights. I tried to make this config more dynamic and ended now with: export default async (app) =\> { /\* ... \*/ .useTailwindColors(true) // We don't want to use fonts configured in tailwind.config.js., so we disable // .useTailwindFontFamily() .useTailwindFontSize(); /\*\* \* Set up fonts \*/ app.setPath('@fonts', '@src/fonts'); // Define font families const fontFamilies = { 'barlow-condensed': { fontFamily: 'Barlow Condensed, sans-se…

There is no `bud` extension yet, though this approach works.
