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

@@ -9,7 +9,7 @@
{% block alpine_data %}codeQualityDashboard(){% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('dev_tools_static', path='admin/js/code-quality-dashboard.js') }}"></script>
<script defer src="{{ url_for('dev_tools_static', path='admin/js/code-quality-dashboard.js') }}"></script>
{% endblock %}
{% block content %}

View File

@@ -10,7 +10,7 @@
{% block alpine_data %}codeQualityViolations(){% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('dev_tools_static', path='admin/js/code-quality-violations.js') }}"></script>
<script defer src="{{ url_for('dev_tools_static', path='admin/js/code-quality-violations.js') }}"></script>
{% endblock %}
{% block content %}

View File

@@ -364,7 +364,7 @@ html {
? 'border-purple-500 dark:border-purple-400 ring-2 ring-purple-500/30'
: 'border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500'"
>
<img :src="image.url" :alt="image.alt" class="w-full h-full object-cover" />
<img loading="lazy" :src="image.url" :alt="image.alt" class="w-full h-full object-cover" />
</button>
</template>
</div>
@@ -3173,5 +3173,5 @@ new Chart(document.getElementById('barChart'), barConfig);
{% block extra_scripts %}
{# ✅ CRITICAL: Load JavaScript file #}
<script src="{{ url_for('dev_tools_static', path='admin/js/components.js') }}"></script>
<script defer src="{{ url_for('dev_tools_static', path='admin/js/components.js') }}"></script>
{% endblock %}

View File

@@ -318,5 +318,5 @@
{% block extra_scripts %}
{# ✅ CRITICAL: Load JavaScript file #}
<script src="{{ url_for('dev_tools_static', path='admin/js/icons-page.js') }}"></script>
{% endblock %}
<script defer src="{{ url_for('dev_tools_static', path='admin/js/icons-page.js') }}"></script>
{% endblock %}

View File

@@ -8,7 +8,7 @@
{% block alpine_data %}testingDashboard(){% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('dev_tools_static', path='admin/js/testing-dashboard.js') }}"></script>
<script defer src="{{ url_for('dev_tools_static', path='admin/js/testing-dashboard.js') }}"></script>
{% endblock %}
{% block content %}

View File

@@ -218,5 +218,5 @@
{% block extra_scripts %}
{# ✅ CRITICAL: Load JavaScript file #}
<script src="{{ url_for('dev_tools_static', path='admin/js/testing-hub.js') }}"></script>
{% endblock %}
<script defer src="{{ url_for('dev_tools_static', path='admin/js/testing-hub.js') }}"></script>
{% endblock %}