diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-10-06 22:11:52 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-10-06 22:11:52 +0200 |
| commit | c85d49fc9ee0b44762feef90031b0b1a5bfdac65 (patch) | |
| tree | 12c9deb1535f4fa1c8f56a4b1a953b536e728667 | |
| parent | 36084155b83e02a87df6211965cf5bcf013f9c99 (diff) | |
Batch chart.js imports
| -rw-r--r-- | layouts/partials/head/index.html | 4 | ||||
| -rw-r--r-- | layouts/shortcodes/chart.html | 1 | ||||
| -rw-r--r-- | layouts/shortcodes/perf-chart.html | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/layouts/partials/head/index.html b/layouts/partials/head/index.html index eb096b8..a17582e 100644 --- a/layouts/partials/head/index.html +++ b/layouts/partials/head/index.html @@ -1,2 +1,6 @@ {{- partial "head/meta" . -}} {{- partial "head/styles" . -}} + +{{- if or (.HasShortcode "chart") (.HasShortcode "perf-chart") -}} +<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> +{{- end -}} diff --git a/layouts/shortcodes/chart.html b/layouts/shortcodes/chart.html index 2198b63..196bdfa 100644 --- a/layouts/shortcodes/chart.html +++ b/layouts/shortcodes/chart.html @@ -24,7 +24,6 @@ <canvas id="{{ $id }}"></canvas> </div> -<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> document.addEventListener('DOMContentLoaded', function() { const ctx = document.getElementById('{{ $id }}').getContext('2d'); diff --git a/layouts/shortcodes/perf-chart.html b/layouts/shortcodes/perf-chart.html index c5b30aa..ff13130 100644 --- a/layouts/shortcodes/perf-chart.html +++ b/layouts/shortcodes/perf-chart.html @@ -47,7 +47,6 @@ <canvas id="{{ $id }}"></canvas> </div> -<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> document.addEventListener('DOMContentLoaded', function() { const ctx = document.getElementById('{{ $id }}').getContext('2d'); |
