Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Make JS async where possible #75

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readthedocs_ext/_templates/readthedocs-insert.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ READTHEDOCS_DATA['source_suffix'] = {{ page_source_suffix|tojson }}
{%- endif %}
</script>

<script type="text/javascript" src="{{ rtd_analytics_url }}"></script>
<script type="text/javascript" src="{{ rtd_analytics_url }}" async="async"></script>

<!-- end RTD <extrahead> -->
3 changes: 2 additions & 1 deletion readthedocs_ext/readthedocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def finalize_media(app):
if sphinx.version_info < (1, 8):
app.builder.script_files.append(js_file)
else:
app.add_js_file(js_file)
kwargs = {'async': 'async'} # Workaround reserved word in Py3.7
app.add_js_file(js_file, **kwargs)


def update_body(app, pagename, templatename, context, doctree):
Expand Down