Skip to content

[WebLink] Confusing explanation of asset preloading #20554

Open
@javiereguiluz

Description

@javiereguiluz

In my opinion, this page is confusing: https://symfony.com/doc/current/web_link.html

There are repeated explanations about asset preloading and they seem to contradict each other:

Activity

javiereguiluz

javiereguiluz commented on Jan 13, 2025

@javiereguiluz
MemberAuthor

What we need to clarify here is:

  • What do browsers need for this feature to work?
  • What must servers do to enable this feature?
  • Related: which servers (and SasS services like Cloudflare) do that for you automatically?
  • What do you need to do in your Twig templates? There are some scenarios:
    • (1) when using only WebLink;
    • (2) When also using AssetMapper;
    • (3) When also using Webpack Encore (is it compatible too?)
94noni

94noni commented on Jan 15, 2025

@94noni
Contributor

@javiereguiluz i’ve experience this as well recently on a project when reading doc and blog and code
@smnandre friendly ping, this relates to our discussion recently on symfony/symfony#59392

To me there is room for doc update indeed, perhaps as well with some graph?

javiereguiluz

javiereguiluz commented on Jan 17, 2025

@javiereguiluz
MemberAuthor

Let's ping our friend @dunglas to see if he can explain this to us and then we can update the docs based on those comments. Thanks.

smnandre

smnandre commented on Jan 18, 2025

@smnandre
Member

Can already answer some of your comments here:

Regarding the contradiction, we may use a better example in the second one, for instance preloading a webfont that will be used in the page but declared in a CSS file.

First comment can be removed i think. It was certainely written on good intention: avoiding someone thinking just using the preload tag will load it's CSS. But in the end i agree it may create more doubts than help.

We can totally write all the answers for the questions you asked, but I also think we should be transparent on the expected impacts, and maybe list the other things to do to achieve better performance (as i'm afraid not everyone is already aware of the first things to check... and would not want people to believe they have to handle this in priority when assets size, lazy loading, cache, should (maybe?) be done before any header optimization)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @javiereguiluz@94noni@smnandre@carsonbot

        Issue actions

          [WebLink] Confusing explanation of asset preloading · Issue #20554 · symfony/symfony-docs