sphinx-tabs icon indicating copy to clipboard operation
sphinx-tabs copied to clipboard

`sphinx-tabs` assets are not removed from pages where `tabs` aren't being used

Open peytondmurray opened this issue 2 years ago • 0 comments

Describe the bug

I was in the process of investigating another issue, and I think sphinx-tabs assets are not currently being removed from pages that they should be in v3.4.4. Here's the result of a debugging session:

image

As you can see, the path in context["css_files"] check here is not quite right. path is of type PosixPath, and the only thing contained in context["css_files"] are objects of type sphinx.builders.html._assets._CascadingStyleSheet. If I check the HTML built by sphinx, I can see that the tabs.css is included, confirming the bug:

image

I think what we want here is

if path.suffix == ".css" and path in [Path(f.filename) for f in context["css_files"]]:

Reproduce the bug

I've updated the minimal working example to use the most recent version of sphinx-tabs: https://github.com/peytondmurray/minimalsphinx/tree/per-page-css

List your environment

No response

peytondmurray avatar Nov 04 '23 21:11 peytondmurray