Skip to content

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

@peytondmurray

Description

@peytondmurray

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions