Commit 84f9d16b authored by Pierre Rudloff's avatar Pierre Rudloff Committed by Waylan Limberg
Browse files

Defer scripts (#1380)

Currently, page rendering is delayed until all scripts are loaded. But these scripts are not essential to the main content. The `defer` attribute allows the browser to render the page before the scripts are completely loaded so the user can see the webpage earlier.
parent 00d0ab92
......@@ -33,9 +33,9 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="{{ base_url }}/js/jquery-1.10.2.min.js"></script>
<script src="{{ base_url }}/js/bootstrap-3.0.3.min.js"></script>
<script src="{{ base_url }}/js/highlight.pack.js"></script>
<script src="{{ base_url }}/js/jquery-1.10.2.min.js" defer></script>
<script src="{{ base_url }}/js/bootstrap-3.0.3.min.js" defer></script>
<script src="{{ base_url }}/js/highlight.pack.js" defer></script>
{%- endblock %}
{%- block analytics %}
......@@ -78,9 +78,9 @@
{%- block scripts %}
<script>var base_url = '{{ base_url }}';</script>
<script src="{{ base_url }}/js/base.js"></script>
<script src="{{ base_url }}/js/base.js" defer></script>
{%- for path in extra_javascript %}
<script src="{{ path }}"></script>
<script src="{{ path }}" defer></script>
{%- endfor %}
{%- endblock %}
......
......@@ -36,9 +36,9 @@
var mkdocs_page_url = {{ page.abs_url|tojson|safe }};
</script>
{% endif %}
<script src="{{ base_url }}/js/jquery-2.1.1.min.js"></script>
<script src="{{ base_url }}/js/modernizr-2.8.3.min.js"></script>
<script type="text/javascript" src="{{ base_url }}/js/highlight.pack.js"></script>
<script src="{{ base_url }}/js/jquery-2.1.1.min.js" defer></script>
<script src="{{ base_url }}/js/modernizr-2.8.3.min.js" defer></script>
<script type="text/javascript" src="{{ base_url }}/js/highlight.pack.js" defer></script>
{%- endblock %}
{%- block extrahead %} {% endblock %}
......@@ -121,9 +121,9 @@
{%- block scripts %}
<script>var base_url = '{{ base_url }}';</script>
<script src="{{ base_url }}/js/theme.js"></script>
<script src="{{ base_url }}/js/theme.js" defer></script>
{%- for path in extra_javascript %}
<script src="{{ path }}"></script>
<script src="{{ path }}" defer></script>
{%- endfor %}
{%- endblock %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment