Skip to content

v0.1.7

Latest
Compare
Choose a tag to compare
@regisphilibert regisphilibert released this 02 Dec 17:02
14d7bdc

Huge Fonts Release

This release improves HUGE/Fonts feature with more control, and better logic.

Cascading Properties

With the new cascade configuration key, user can define properties which will cascade down to every font at-rule. It is useful to apply a global font-display strategy or simply pre-fill the most commonly used font-family

# _huge/config/fonts.yaml
cascade:
  display: swap
  family: "Open"
  local: false
fonts:
- file: fonts/open-sans-v17-latin
  weight: 400
- file: fonts/open-sans-v17-latin-300italic
  style: italic
- family: Comic Sans
  file: fonts/oh-no-not-comic-sans
  local: Comic Sans

Better Preload!

Previously preload simply printed a "preload" tag for every woff2 files found because it seemed appropriate for modern usage. This release gives user much more control over what gets preloaded.

The new preload setting is set at the font level and now takes a boolean or a slice of formats.
With a boolean we'll simply preload all (true) or none (false) of the files found for that font.
With a slice we'll only preload the files whose format is included in the slice.

Of course, using cascade, you can set a default preload strategy for every fonts.

# _huge/config/fonts.yaml
preload:
- woff2
fonts:
- family: Open
  file: fonts/open-sans-v17-latin
  weight: 400
- family: Comic Sans
  file: fonts/oh-no-not-comic-sans
  preload: false

WARNING: Formats are not extensions, we're expecting the exact keyword for the font formats listed on the @font-face at rule src documentation

Variable Fonts with the new tech font setting!

The only thing between HUGE/Fonts and Variable Fonts was a missing tech attribute to be passed down to @font-face at rule:

fonts:
- family: My Var Font
  file: fonts/my-var-font
  weight: 125 950;
  tech: variations
@font-face {
  font-family: My Var Font;
  font-weight: 125 950;
  src: url("/fonts/my-var-font.ttf") format("truetype") tech("variations");
}

Noteworthy changes:

  • disable_local is deprecated in favour of the more powerfull cascade.local setting.
  • Preloading is no longer set per environment. It is either enabled or disabled for every environment following the preload logic discussed above.

What's Changed

Full Changelog: v0.1.6...v0.1.7