@@ -59,7 +59,8 @@ correct prioritization and the content security policy:
59
59
60
60
<head>
61
61
<!-- ... -->
62
- <link rel="preload" href="{{ preload('/app.css', { as: 'style' }) }}">
62
+ <link rel="preload" href="{{ preload('/app.css', {as: 'style'}) }}" as="style">
63
+ <link rel="stylesheet" href="/app.css">
63
64
</head>
64
65
65
66
If you reload the page, the perceived performance will improve because the
@@ -74,7 +75,8 @@ requested the HTML page.
74
75
75
76
<head>
76
77
<!-- ... -->
77
- <link rel="preload" href="{{ preload(asset('build/app.css')) }}">
78
+ <link rel="preload" href="{{ preload(asset('build/app.css')) }}" as="style">
79
+ <!-- ... -->
78
80
</head>
79
81
80
82
Additionally, according to `the Priority Hints specification `_, you can signal
@@ -84,7 +86,8 @@ the priority of the resource to download using the ``importance`` attribute:
84
86
85
87
<head>
86
88
<!-- ... -->
87
- <link rel="preload" href="{{ preload('/app.css', { as: 'style', importance: 'low' }) }}">
89
+ <link rel="preload" href="{{ preload('/app.css', {as: 'style', importance: 'low'}) }}" as="style">
90
+ <!-- ... -->
88
91
</head>
89
92
90
93
How does it work?
@@ -108,7 +111,8 @@ issuing an early separate HTTP request, use the ``nopush`` option:
108
111
109
112
<head>
110
113
<!-- ... -->
111
- <link rel="preload" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
114
+ <link rel="preload" href="{{ preload('/app.css', {as: 'style', nopush: true}) }}" as="style">
115
+ <!-- ... -->
112
116
</head>
113
117
114
118
Resource Hints
@@ -142,7 +146,8 @@ any link implementing the `PSR-13`_ standard. For instance, any
142
146
<head>
143
147
<!-- ... -->
144
148
<link rel="alternate" href="{{ link('/index.jsonld', 'alternate') }}">
145
- <link rel="preload" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
149
+ <link rel="preload" href="{{ preload('/app.css', {as: 'style', nopush: true}) }}" as="style">
150
+ <!-- ... -->
146
151
</head>
147
152
148
153
The previous snippet will result in this HTTP header being sent to the client:
0 commit comments