Skip to content

Commit

Permalink
[fix] don't append CSS files to the end of html_static_path list (#153)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
return42 authored Mar 16, 2022
1 parent 53b6a63 commit 154f273
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sphinx_tabs/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 154f273

Please sign in to comment.