preload.twig with CLONEDTHEME or SUBTHEME (documentation incomplete)

Created on 1 July 2023, about 1 year ago
Updated 3 July 2023, 12 months ago

preload.twig with CLONEDTHEME or SUBTHEME (documentation incomplete)

SEE:
https://docs.varbase.vardot.com/v/10.0.x/developers/theme-development-wi...

Currently the documentation implies using a custom "MYTHEME" example... Whether this is a clone or subtheme is unclear.

PROJECT_PATH/themes/custom/MYTHEME/templates/includes/preload.twig

It states to include the following:

<link rel="preload" href="/{{ MYTHEME_path }}/fonts/lora/Lora-Regular.ttf" as="font" type="font/tff" crossorigin="anonymous">

This wouldn't work in a custom or subtheme, because of 'MYTHEME_path' , is unique to 'vartheme_bs5' theme

Proposed resolution

Update the varbase documentation to a working solution for preloading fonts in either a cloned theme and/or subtheme.

EX:

cloned theme
<link rel="preload" href="/{{ MYTHEME_path }}/fonts/lora/Lora-Regular.ttf" as="font" type="font/tff" crossorigin="anonymous">

or subtheme
with instructrions on all the files you'll need to include

/docroot/themes/custom/MYSUBTHEME/templates/system/html.html.twig
/docroot/themes/custom/MYSUBTHEME/MYSUBTHEME.theme
etc...

or better yet...

Use something like 'bs_base' theme is doing, by simply including the preload into the MYTHEME.info.yml

https://www.drupal.org/docs/8/themes/bs-base/additional-features/fonts-p... ā†’

preload-fonts:
  - fonts/Roboto-Regular.woff2
  - '@custom_theme/fonts/Roboto-Bold.woff2'
  - /libraries/shariff/fontawesome-webfont.woff2
  - https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu72xKOzY.woff2

Remaining tasks

  • āœ… File an issue about this project
  • āŒ Addition/Change/Update/Fix to this project
  • āŒ Testing to ensure no regression
  • āŒ Automated unit/functional testing coverage
  • āŒ Developer Documentation support on feature change/addition
  • āŒ User Guide Documentation support on feature change/addition
  • āŒ Accessibility and Readability
  • āŒ Code review from 1 Varbase core team member
  • āŒ Full testing and approval
  • āŒ Credit contributors
  • āŒ Review with the product owner
  • āŒ Update Release Notes and Update Helper on new feature change/addition
  • āŒ Release

Varbase update type

  • āœ… No Update
  • āž– Optional Update
  • āž– Forced Update
  • āž– Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
āœØ Feature request
Status

Active

Version

3.0

Component

Code

Created by

šŸ‡ŗšŸ‡øUnited States duntuk

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

Comments & Activities

Production build 0.69.0 2024