From b97a05c2332cb724701d2a333fb5d6a7ed5bd4e8 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 22 May 2022 17:48:04 +0200 Subject: [PATCH] Use multi-stylesheet feature (available since Sphinx 5.1) --- doc/customization.rst | 32 ++------------------ src/insipid_sphinx_theme/insipid/layout.html | 1 - src/insipid_sphinx_theme/insipid/theme.conf | 2 +- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/doc/customization.rst b/doc/customization.rst index 30b6c96..43bc5e8 100644 --- a/doc/customization.rst +++ b/doc/customization.rst @@ -165,7 +165,7 @@ with a content similar to this: [theme] inherit = insipid - stylesheet = ???.css + stylesheet = base.css, insipid.css, ???.css sidebars = ???.html, ???.html, ???.html pygments_style = ??? @@ -187,36 +187,8 @@ if you insist on not deriving from any theme). You should also create a sub-directory named :file:`static` containing your main CSS file (and probably additional CSS files) and any custom JavaScript files you want to use. -Write the name of your main CSS file to the ``stylesheet`` field in your +Add the name of your main CSS file to the ``stylesheet`` field in your :file:`theme.conf`. -Remove the ``stylesheet`` field if you don't want to use your own CSS file. - -By default, the CSS file :file:`insipid.css` will *not* be included, -but :file:`basic.css` and :file:`insipid-sidebar-readthedocs.css` -will be included. - -To include :file:`insipid.css`, add this to your :file:`layout.html` template: - -.. code-block:: html+jinja - - {% extends "insipid/layout.html" %} - - {% block css %} - - {{ super() }} - {% endblock %} - -Similarly, you can add further custom CSS files, if you want. - -.. note:: - - You *could* alternatively use this in your CSS file: - - .. code-block:: css - - @import 'insipid.css'; - - But this will increase the load time of the HTML pages! If you want to use custom JavaScript files, store them in the :file:`static` sub-directory of your theme directory diff --git a/src/insipid_sphinx_theme/insipid/layout.html b/src/insipid_sphinx_theme/insipid/layout.html index e8d277e..dedaeff 100644 --- a/src/insipid_sphinx_theme/insipid/layout.html +++ b/src/insipid_sphinx_theme/insipid/layout.html @@ -48,7 +48,6 @@ {% block css %} - {{- super() }} {%- if READTHEDOCS|tobool and render_sidebar %} diff --git a/src/insipid_sphinx_theme/insipid/theme.conf b/src/insipid_sphinx_theme/insipid/theme.conf index 7d4aa32..0c66ce7 100644 --- a/src/insipid_sphinx_theme/insipid/theme.conf +++ b/src/insipid_sphinx_theme/insipid/theme.conf @@ -1,6 +1,6 @@ [theme] inherit = basic -stylesheet = insipid.css +stylesheet = basic.css, insipid.css sidebars = globaltoc.html, separator.html, indices.html pygments_style = friendly