Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300751

Support prefetch/preload/dns-prefetch in the libraries API

$
0
0

Problem/Motivation

Olivero ships a preload template with the following:

<link rel="preload" href="{{ olivero_path }}/fonts/metropolis/Metropolis-Regular.woff2" as="font" type="font/woff2" crossorigin>
<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>
<link rel="preload" href="{{ olivero_path }}/fonts/lora/lora-v14-latin-regular.woff2" as="font" type="font/woff2" crossorigin>

This is to support fonts.css which is loaded as part of the global-styling library.

I think we should look at generic support for adding link tags as part of library definitions at the same level as CSS and JS. This can then be added to the HTML head via the same mechanism as #attached['html_head']. Via that, we'd then be able to support prefetch, preload, and dns-prefetch and possibly other things.

Steps to reproduce

Proposed resolution

Add support to the libraries/assets API.

Convert Olivero to use it (either in this issue or a follow-up).

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 300751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>