Problem/Motivation

There are two improvements we should implement regarding font handling in the theme:

1. Dynamic @font-face generation in SASS
The current SASS code in sass/theme/partials/_fonts.scss uses hardcoded keys to generate @font-face declarations. This limits flexibility and makes it difficult to support additional font features, such as variable fonts or custom font-face rules required by the design. Refactoring this logic will allow more scalable and maintainable font configuration.

2. Loading order of @font-face in compiled CSS
The compiled @font-face declarations currently appear at the end of css/theme/theme.css, which is loaded after all other theme CSS files. This delays font availability and may cause a flash of unstyled text (FOUT). To improve rendering performance, @font-face declarations should be placed at the beginning of the CSS output, ensuring fonts are defined before they're used in other style rules.

Issue fork bs_base-3539463

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pivica created an issue. See original summary.

  • pivica committed 27f73f4b on 2.0.x
    Resolve #3539463 "Optimize font face generation"
    
pivica’s picture

Status: Active » Fixed

Done.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.