templates: Defer all script execution.

This allows parsing and resource loading to continue in parallel with
script fetching.  It also means we don’t need to concern ourselves
with explicitly waiting for the DOM to become ready.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-09-13 17:44:53 -07:00 committed by Tim Abbott
parent 9b38bcc2a6
commit f1ecd3c18b
1 changed files with 2 additions and 1 deletions

View File

@ -28,7 +28,8 @@
{% endblock %}
{% macro bundle(name) %}
{{ render_bundle(name, attrs='nonce="%s"' % (csp_nonce,) if csp_nonce else '') }}
{{ render_bundle(name, 'css', attrs='nonce="%s"' % (csp_nonce,) if csp_nonce else '') }}
{{ render_bundle(name, 'js', attrs='defer nonce="%s"' % (csp_nonce,) if csp_nonce else 'defer') }}
{% endmacro %}
<!-- This is a temporary block to enable webpack transition