Automatically add cache bust query string to icons.woff

Created on 28 April 2025, 12 days ago

Problem/Motivation

When updating font icons with new icons we need to tell web browser to cache bust this asset so the new icons are loaded. For this we have `$bs-icon-font-hash` SASS variable that should be incremented manually each time when font is updated. The problem is that it is a manual process so ofter developers forget to increment it. Additional complication is that if font preloading is used then we also need to manually increase hash value there and if we forget then browser will load same font icon asset two time.
This is not ideal and we should try to automate this process if possible.

Proposed resolution

Calculate hash value based on font icon content so it is always unique and it will change if font icons content changes.

Remaining tasks

API changes

None.

Feature request
Status

Active

Version

2.0

Component

BS Base

Created by

🇷🇸Serbia pivica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pivica
  • 🇷🇸Serbia pivica

    MR ready for a review.

    The whole thing is fit into the current theme build process, so nothing is changed there. The step package.json `build-icons` step now use execute `node build-icons.js` and all hash calculation and update of needed files is done there. Hash is injected as a SASS variable - with existing $bs-icon-font-hash variable, and it is also injected into theme info yaml file if icons font asset preloading is used.

    I considered couple of approaches for this but on the end I sticked to this solution because this is how we currently update are icons assets - child themes icons and build process is separated from parent theme icons and build process.

    New update function `bs_base_bs_update_200003()` should update child themes to this new hash fully so no manual update process is needed.

  • Pipeline finished with Skipped
    10 days ago
    #485855
    • pivica committed dc395ec4 on 2.0.x
      Issue #3521572 by pivica, berdir: Automatically add cache bust query...
  • 🇨🇭Switzerland berdir Switzerland
  • 🇷🇸Serbia pivica

    @berdir provided couple of feedbacks, all are addressed, this is merged.

Production build 0.71.5 2024