preload.twig with CLONEDTHEME or SUBTHEME (documentation incomplete)

Created on 1 July 2023, over 1 year ago
Updated 3 July 2023, over 1 year 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.71.5 2024