Optimize the JS loading priorities
This commit is contained in:
parent
d5413a954f
commit
fd97067ec3
3 changed files with 22 additions and 20 deletions
|
@ -62,13 +62,8 @@
|
||||||
|
|
||||||
{% include css-selector.html %}
|
{% include css-selector.html %}
|
||||||
|
|
||||||
<!-- JavaScripts -->
|
<!-- JavaScript -->
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
|
||||||
|
|
||||||
<script defer
|
|
||||||
src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
{% include js-selector.html %}
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -2,18 +2,34 @@
|
||||||
JS selector for site.
|
JS selector for site.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!-- common -->
|
||||||
|
|
||||||
|
<script async src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
{% if jekyll.environment == 'production' %}
|
||||||
|
<!-- PWA -->
|
||||||
|
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
||||||
|
|
||||||
|
<!-- GA -->
|
||||||
|
{% if site.google_analytics.id %}
|
||||||
|
{% include google-analytics.html %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- layout specified -->
|
||||||
|
|
||||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||||
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
||||||
<!-- pv-report needs countup.js -->
|
<!-- pv-report needs countup.js -->
|
||||||
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
|
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
|
||||||
<script async src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
|
<script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.layout == 'post' or page.layout == 'page' %}
|
{% if page.layout == 'post' or page.layout == 'page' %}
|
||||||
<!-- image lazy-loading & popup -->
|
<!-- image lazy-loading & popup -->
|
||||||
<script async
|
<script src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js"></script>
|
||||||
src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js"></script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.layout == 'home'
|
{% if page.layout == 'home'
|
||||||
|
@ -50,14 +66,3 @@
|
||||||
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
|
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if jekyll.environment == 'production' %}
|
|
||||||
<!-- PWA -->
|
|
||||||
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
|
||||||
|
|
||||||
<!-- GA -->
|
|
||||||
{% if site.google_analytics.id %}
|
|
||||||
{% include google-analytics.html %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ layout: compress
|
||||||
|
|
||||||
{% include search-loader.html %}
|
{% include search-loader.html %}
|
||||||
|
|
||||||
|
{% include js-selector.html %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue