perf: add defer to scripts and lazy loading to images
Some checks failed
CI / ruff (push) Successful in 14s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Add defer attribute to 145 <script> tags across 103 template files
(PERF-067) and loading="lazy" to 22 <img> tags across 13 template
files (PERF-058). Both improve page load performance.

Validator totals: 0 errors, 2 warnings, 1360 info (down from 1527).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 20:55:52 +01:00
parent 3a7cf29386
commit 8ee8c398ce
110 changed files with 193 additions and 193 deletions

View File

@@ -636,5 +636,5 @@
{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('cms_static', path='admin/js/content-page-edit.js') }}"></script>
<script defer src="{{ url_for('cms_static', path='admin/js/content-page-edit.js') }}"></script>
{% endblock %}

View File

@@ -178,5 +178,5 @@
{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('cms_static', path='admin/js/content-pages.js') }}"></script>
<script defer src="{{ url_for('cms_static', path='admin/js/content-pages.js') }}"></script>
{% endblock %}

View File

@@ -322,5 +322,5 @@
{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('cms_static', path='store/js/content-page-edit.js') }}"></script>
<script defer src="{{ url_for('cms_static', path='store/js/content-page-edit.js') }}"></script>
{% endblock %}

View File

@@ -323,5 +323,5 @@
{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('cms_static', path='store/js/content-pages.js') }}"></script>
<script defer src="{{ url_for('cms_static', path='store/js/content-pages.js') }}"></script>
{% endblock %}

View File

@@ -321,7 +321,7 @@
<!-- Preview -->
<div class="bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden">
<template x-if="selectedMedia?.media_type === 'image'">
<img :src="selectedMedia?.file_url" :alt="selectedMedia?.original_filename" class="w-full h-auto">
<img loading="lazy" :src="selectedMedia?.file_url" :alt="selectedMedia?.original_filename" class="w-full h-auto">
</template>
<template x-if="selectedMedia?.media_type !== 'image'">
<div class="aspect-square flex items-center justify-center text-gray-400">
@@ -441,5 +441,5 @@
{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('cms_static', path='store/js/media.js') }}"></script>
<script defer src="{{ url_for('cms_static', path='store/js/media.js') }}"></script>
{% endblock %}