From 210802590aaf89f570b6c16174113600d58d9f10 Mon Sep 17 00:00:00 2001 From: Lauri Eskola <lauri.eskola@acquia.com> Date: Fri, 30 Oct 2020 14:48:18 +0200 Subject: [PATCH] Issue #3176910 by kishor_kolekar, anmolgoyal74, hansa11, kostyashupenko, mherchel: Move Olivero's preload.twig documentation to @file and include variables passed for the template --- core/themes/olivero/templates/includes/preload.twig | 10 ++++++++-- core/themes/olivero/templates/layout/html.html.twig | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/themes/olivero/templates/includes/preload.twig b/core/themes/olivero/templates/includes/preload.twig index b3d5811d8291..2fc4a369d6ac 100644 --- a/core/themes/olivero/templates/includes/preload.twig +++ b/core/themes/olivero/templates/includes/preload.twig @@ -1,6 +1,12 @@ {# - Preload the fonts for the headings and normal body copy (non bold and non italic). - #} +/** + * @file + * Preload the non-bold & non-italic fonts for the headings and the body copy. + * + * Available variables: + * - olivero_path: Returns the path to the Olivero theme. + */ +#} <link rel="preload" href="/{{ olivero_path }}/fonts/metropolis/Metropolis-SemiBold.woff2" as="font" type="font/woff2" crossorigin> <link rel="preload" href="/{{ olivero_path }}/fonts/metropolis/Metropolis-Bold.woff2" as="font" type="font/woff2" crossorigin> diff --git a/core/themes/olivero/templates/layout/html.html.twig b/core/themes/olivero/templates/layout/html.html.twig index 64e719c6518d..723fb526c3d5 100644 --- a/core/themes/olivero/templates/layout/html.html.twig +++ b/core/themes/olivero/templates/layout/html.html.twig @@ -19,6 +19,7 @@ * - db_offline: A flag indicating if the database is offline. * - placeholder_token: The token for generating head, css, js and js-bottom * placeholders. + * - olivero_path: Returns the path to an Olivero theme * * @see template_preprocess_html() */ @@ -38,7 +39,7 @@ <title>{{ head_title|safe_join(' | ') }}</title> <css-placeholder token="{{ placeholder_token }}"> <js-placeholder token="{{ placeholder_token }}"> - {% include '@olivero/includes/preload.twig' %} + {% include '@olivero/includes/preload.twig' with { olivero_path: olivero_path } only %} {{ noscript_styles }} </head> <body{{ attributes.addClass(body_classes) }}> -- GitLab