Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebLink] Confusing explanation of asset preloading #20554

Open
javiereguiluz opened this issue Jan 10, 2025 · 4 comments
Open

[WebLink] Confusing explanation of asset preloading #20554

javiereguiluz opened this issue Jan 10, 2025 · 4 comments
Labels

Comments

@javiereguiluz
Copy link
Member

javiereguiluz commented Jan 10, 2025

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:

@javiereguiluz
Copy link
Member Author

javiereguiluz commented Jan 13, 2025

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
Copy link
Contributor

94noni commented Jan 15, 2025

@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
Copy link
Member Author

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
Copy link
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
Labels
Projects
None yet
Development

No branches or pull requests

4 participants