Skip to content

Commit

Permalink
Include basic theme's JS files
Browse files Browse the repository at this point in the history
I wanted to optimize the number of downloads we make, but ReadTheDocs
assumes that all documentation pages include jQuery.
  • Loading branch information
pradyunsg committed Sep 9, 2020
1 parent f9876a5 commit bea26d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/furo/theme/base.html
Expand Up @@ -64,9 +64,15 @@

{# Custom JS #}
{%- block extrajs -%}
{# This is *exactly* how `basic` handles this file. #}
<script id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{%- for path in script_files -%}
{# We don't want Sphinx's hard-coded scripts #}
{%- if path not in ["_static/jquery.js", "_static/underscore.js", "_static/doctools.js", "_static/language_data.js"] -%}
{# We want Sphinx's hard-coded scripts to be loaded synchronously #}
{%- if path in ["_static/jquery.js", "_static/underscore.js"] -%}
<script src="{{ pathto(path, 1) }}" async></script>
{% elif path in ["_static/doctools.js", "_static/language_data.js"] %}
<script src="{{ pathto(path, 1) }}" defer></script>
{% else %}
<script src="{{ pathto(path, 1) }}"></script>
{%- endif -%}
{% endfor -%}
Expand Down
6 changes: 0 additions & 6 deletions src/furo/theme/search.html
@@ -1,12 +1,6 @@
{% extends "base.html" %}

{%- block extrajs -%}
<script id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{%- for path in script_files -%}
{# We want Sphinx's hard-coded scripts, since they're needed for
search to work. #}
<script src="{{ pathto(path, 1) }}"></script>
{% endfor -%}
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>
{%- endblock extrajs-%}

Expand Down

0 comments on commit bea26d9

Please sign in to comment.