5

I'd like to build docs using Sphinx, but without any JavaScript. Is there a straight forward way to configure Sphinx not to include any JavaScript? Setting an empty html_js_files in the conf.py doesn't do the trick.

Obviously there will be some functionality missing, like the search box. However it seems that no core functionality that I care about is impacted when manually removing the scripts.

1 Answer 1

2

Modify your theme's template where the JavaScript is included, removing that HTML tag.

Sign up to request clarification or add additional context in comments.

7 Comments

Theme modification is easy, I'm talking about the scripts Sphinx includes (doctools, jquery, searchtools, underscore, ...)
You should not have HTML that references a missing file, so theme modification is required. It's OK to have files on the file system that are not referenced in the HTML. You can (probably?) remove the offending JavaScript files from your theme's source directory, and they won't be copied to the build directory, if they really bother you.
Again, I'm not talking about additional js files that come with a theme. I'm talking about the js that sphinx comes with by default and is included in every page, regardless of whatever theme you use.
Can you please edit the question and explain what you mean by "js that sphinx comes with by default and is included in every page"? Is it the <script> tags? Something like this? stackoverflow.com/a/32786687/407651
@mzjn now I see why this happend, the themes I was looking at didn't have the script tag in the markup, but rather: {%- for scriptfile in script_files %} {{ js_tag(scriptfile) }} {%- endfor %}
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.