From 887062b51c161ddcda13e61bb981701beb036173 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 11 Mar 2022 16:06:17 +0100 Subject: [PATCH] [fix] don't append CSS files to the end of html_static_path list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit html_static_path is a list of paths that contain custom static files. They are copied to the output’s _static directory **after** the theme’s static files, so a file named default.css will overwrite the theme’s default.css [1] Without this patch a tabs.css can't be overwritten by the `conf.py` file: html_static_path = [ 'static/tabs.css', ] The /static folder from sphinx-tabs needs to be added in front of html_static_path since the last item in the list will be written last to /_static. [1] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path Signed-off-by: Markus Heiser --- sphinx_tabs/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_tabs/tabs.py b/sphinx_tabs/tabs.py index e99c500..4c0b6ca 100644 --- a/sphinx_tabs/tabs.py +++ b/sphinx_tabs/tabs.py @@ -355,7 +355,7 @@ def setup(app): static_dir = Path(__file__).parent / "static" app.connect( "builder-inited", - (lambda app: app.config.html_static_path.append(static_dir.as_posix())), + (lambda app: app.config.html_static_path.insert(0, static_dir.as_posix())), ) app.connect("config-inited", update_config) app.connect("html-page-context", update_context)