refactor: improve js module loading order

This commit is contained in:
Cotes Chung 2024-04-29 03:43:33 +08:00
parent e0950fc973
commit b77767f76e
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
7 changed files with 16 additions and 17 deletions

View file

@ -65,7 +65,7 @@
{% endcase %}
{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %}
<script defer src="{{ script | relative_url }}"></script>
<script src="{{ script | relative_url }}"></script>
{% if page.math %}
<!-- MathJax -->
@ -88,6 +88,10 @@
{% endif %}
{% endif %}
{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}
{% if jekyll.environment == 'production' %}
<!-- PWA -->
{% if site.pwa.enabled %}

View file

@ -1,5 +1,5 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
basic();
initSidebar();
initTopbar();
basic();

View file

@ -1,8 +1,8 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
import { initLocaleDatetime, loadImg } from './modules/plugins';
basic();
loadImg();
initLocaleDatetime();
initSidebar();
initTopbar();
initLocaleDatetime();
loadImg();
basic();

View file

@ -1,7 +1,7 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
import { initLocaleDatetime } from './modules/plugins';
basic();
initSidebar();
initTopbar();
initLocaleDatetime();
basic();

View file

@ -1,9 +1,9 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
import { loadImg, imgPopup, initClipboard } from './modules/plugins';
basic();
initSidebar();
initTopbar();
loadImg();
imgPopup();
initSidebar();
initTopbar();
initClipboard();
basic();

View file

@ -7,11 +7,11 @@ import {
toc
} from './modules/plugins';
initSidebar();
initTopbar();
loadImg();
toc();
imgPopup();
initSidebar();
initLocaleDatetime();
initClipboard();
toc();
initTopbar();
basic();

View file

@ -75,13 +75,8 @@ layout: compress
{% endif %}
<!-- JavaScripts -->
{% include js-selector.html lang=lang %}
{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}
{% include_cached search-loader.html lang=lang %}
</body>
</html>