
- 19 Січ 2024
- 30
- 13
- Автор теми
- #1


<IfModule mod_expires.c>
ExpiresActive On
AddType image/webp .webp
# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
# Video
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType application/x-font-woff2 .woff2
AddType image/svg+xml .svg
# CSS, JavaScript
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType application/x-font-woff2 "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
# Others
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
</IfModule>


Для файлів які відповідають за макет(DOM) додаємо спеціальний метатег rel="preload", а для неважливих rel="prefetch", наприклад:
<!DOCTYPE html>
<html lang="uk-UA">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Важливі файли: -->
<link rel="preload" href="template.js" as="script">
<link rel="preload" href="template.css" as="style">
<!-- НЕ важливі файли: -->
<link rel="prefetch" href="/777.js" as="script">
<link rel="prefetch" href="/777.css" as="style">
<link rel="stylesheet" href="template.css">
<script src="template.js"></script>
</head>
<body>
<!-- * -->
<link rel="stylesheet" href="/777.css">
<script src="/777.js" async></script>
</body>
</html>




Обов'язково на усіх важливих сторінках має бути звірка розмірів картинок! Також завжди стискайте картинки такими сервісами як - tinypng.com.
Хочеш бути чемпіоном



P.S. В "CMS-Ardila" - Ви просто в шаблоні виставляєте в необхідному порядку файли JS та CSS а двигунчик, коли генерить сторінку їх стискає або в 1 файл або запис в <head>...