Skip to content

sphinx-tabs inadvertently removes css and js #183

@peytondmurray

Description

@peytondmurray

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 including sphinx-tabs assets globally and then removing them upon html-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 at html-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 upon html-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 the apidocs.html will only include the css if sphinx-tabs is disabled.

List your environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions