-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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] improve web_link #20212
[WebLink] improve web_link #20212
Conversation
Isn't the previous code enough because the application sends the required information as additional HTTP headers (see https://symfony.com/doc/current/web_link.html#how-does-it-work)? |
It's enough for the headers, not for the proper HTML tags in the |
On symfony.com we have something like this on templates: {% block importmap %}
{{ importmap(['app', 'search', 'home']) }}
{% endblock %} And that generates these HTML tags: <link rel="stylesheet" href="/assets/vendor/bootstrap/dist/css/bootstrap.min-1712f0378f8675ca7cd423d6262fcccf.css">
<link rel="stylesheet" href="/assets/styles/app-c5e5f7501da9d82bf95c197610450518.css">
<link rel="stylesheet" href="/assets/styles/search-8ccfaff80d2880d747e9efe1089469d2.css">
<!-- ... --> That alone is enough to enable the preloading of those assets: But, we use Cloudflare. In the HTTP Response headers, we can see those early hints headers: So, maybe let's ask @dunglas who knows a lot about these things. Is the change proposed in this PR really needed when you don't use Cloudflare or some similar server? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me. It fixes the fallback using a HTML link elements, when it's not possible/supported to use HTTP headers.
68461b9
to
35c94bc
Compare
Merged! Massimiliano thanks for fixing this and Kévin thanks for reviewing it. |
Also, about my previous comment here (#20212 (comment)) I forgot that the |
The current doc for generating the proper lines in the
head
section is quite misleading, acting as if it could be enough to use a single line to include a style/script, while two lines each are needed. Moreover, despite mentioning the need for theas
attribute, if fails to add it in the examples.The proposed changes should fix both problems.