You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/pages/6.0/08.pages-and-layout/04.filters-and-functions/docs.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,21 @@ Preloads assets for better performance by telling the browser to fetch them earl
78
78
79
79
This generates `<link rel="modulepreload">` tags for JavaScript modules and `<link rel="preload">` tags for other assets, allowing the browser to fetch them in parallel with the page load.
80
80
81
+
#### vite_css_preload
82
+
83
+
Emits `<link rel="preload" as="style">` hints specifically for CSS files associated with an entry point:
84
+
85
+
```twig
86
+
{{ vite_css_preload('main.ts') }}
87
+
```
88
+
89
+
This tells the browser to start fetching your stylesheets as early as possible, before the CSS `<link>` tags are processed. It's typically called just before `vite_css()` in your layout template to improve perceived load performance:
90
+
91
+
```twig
92
+
{{ vite_css_preload('main.ts') }}
93
+
{{ vite_css('main.ts') }}
94
+
```
95
+
81
96
> [!NOTE]
82
97
> Further information on how to use these functions and how they work under the hood will be covered in the [Assets and Vite](/assets-vite) chapter.
0 commit comments