New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sphinx-tabs inadvertently removes css and js #183
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
This is potentially the same as #180, or caused by the fix of that issue. What version of the package are you using? |
Thanks for including the example - this pins an earlier version, so please try it with the latest |
@foster999 Thanks, you're absolutely right that upgrading fixed the issue. I looked at the differences between What exactly does moving the slicing operation do here? context["css_files"] = context["css_files"][:] which in my mind means 'set the |
Afraid I'm still baffled by the slicing too! My feeling was that it's something to do with updating all references to the object (and nested objects inside it) vs just updating the single reference. Kinda like shallow vs deep copying. But didn't understand how that lead to the issue. I was surprised the issue hadn't come up sooner, though it seems to be themes rather than other extensions that were affected. So maybe something to do with the order that sphinx evaluates things 🤷 |
Thanks again for the help! |
Describe the bug
context
When I use the
sphinx-tabs
extension and I include css or js in specific pages, this function removes it even if I intend for it to be included.expectation
I expect
sphinx-tabs
to leave my included css/js alone. Rather than includingsphinx-tabs
assets globally and then removing them uponhtml-page-context
if the page doesn't have any tabs directives, this package should only insert those assets if the page does have a tabs directive, not the other way around. This can also be done athtml-page-context
time.bug
Instead,
sphinx-tabs
automatically removes all css/js unless it is included on every single page.problem
This is a problem for people who want to include assets on specific pages to keep page load times down, but who also want to use tabs. Both sphinx docs and
pydata-sphinx-theme
docs suggest inserting css/js assets uponhtml-page-context
, so the current behavior is extremely confusing because your assets get removed in the background, leaving you wondering how this is happening.Reproduce the bug
Here's a small working example: https://github.com/peytondmurray/minimalsphinx/tree/per-page-css
You'll see if you run
make html
that theapidocs.html
will only include the css ifsphinx-tabs
is disabled.List your environment
No response
The text was updated successfully, but these errors were encountered: