mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-06-07 16:17:50 +00:00

Some checks failed
Close stale issues and PRs / stale (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Style Lint / stylelint (push) Has been cancelled
Lint Commit Messages / commitlint (push) Has been cancelled
Build and Deploy / build (push) Has been cancelled
Build and Deploy / deploy (push) Has been cancelled
- Ensure inline scripts execute after the DOM has fully loaded. - Use Rollup to bundle the theme-mode and Mermaid scripts, reducing the number of Jekyll include snippets.
27 lines
745 B
HTML
27 lines
745 B
HTML
{% assign urls = include.urls | split: ',' %}
|
|
|
|
{% assign combined_urls = null %}
|
|
|
|
{% assign domain = 'https://cdn.jsdelivr.net/' %}
|
|
|
|
{% for url in urls %}
|
|
{% if url contains domain %}
|
|
{% assign url_snippet = url | slice: domain.size, url.size %}
|
|
|
|
{% if combined_urls %}
|
|
{% assign combined_urls = combined_urls | append: ',' | append: url_snippet %}
|
|
{% else %}
|
|
{% assign combined_urls = domain | append: 'combine/' | append: url_snippet %}
|
|
{% endif %}
|
|
|
|
{% elsif url contains '//' %}
|
|
<script defer src="{{ url }}"></script>
|
|
{% else %}
|
|
<script defer src="{{ url | relative_url }}"></script>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if combined_urls %}
|
|
<script defer src="{{ combined_urls }}"></script>
|
|
{% endif %}
|