Sphinx
HTML构建器呈现的脚本标记在我的情况下是不必要的。
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
它们为页面加载增加了相当大的延迟。有没有办法阻止构建器呈现这些标记?
这是基本主题在layout.html模板中完成的方式:
{%- for scriptfile in script_files %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
{%- endfor %}
它在StandaloneHTMLBuilder(Builder)
类中进行了硬编码:
# This is a class attribute because it is mutated by Sphinx.add_javascript.
script_files = ['_static/jquery.js', '_static/underscore.js',
'_static/doctools.js']
答案 0 :(得分:0)
你可以“修补”from sphinx.builders.html import StandaloneHTMLBuilder
StandaloneHTMLBuilder.script_files = []
标签。如果将以下行添加到conf.py中,则标记将不会包含在HTML输出中:
text-center