Skip to content

Commit 5175f11

Browse files
committed
FIX: don't include _static in css_files
1 parent 4614e8f commit 5175f11

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/sphinx_book_theme/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def hash_assets_for_files(assets: list, theme_static: Path, context, app):
9393
asset_type = "css_files" if asset_path.endswith(".css") else "script_files"
9494
if asset_type in context:
9595
# Define paths to the original asset file, and its linked file in Sphinx
96-
asset_sphinx_link = f"_static/{asset_path}"
9796
asset_source_path = theme_static / asset_path
9897
if not asset_source_path.exists():
9998
SPHINX_LOGGER.warning(
@@ -103,18 +102,15 @@ def hash_assets_for_files(assets: list, theme_static: Path, context, app):
103102
for ii, other_asset in enumerate(context[asset_type]):
104103
# TODO: eventually the contents of context['css_files'] etc should probably
105104
# only be _CascadingStyleSheet etc. For now, assume mixed with strings.
106-
if (
107-
getattr(other_asset, "filename", str(other_asset))
108-
!= asset_sphinx_link
109-
):
105+
if getattr(other_asset, "filename", str(other_asset)) != asset_path:
110106
continue
111107
# Take priority from existing asset or use default priority (500)
112108
priority = getattr(other_asset, "priority", 500)
113109
# Remove existing asset
114110
del context[asset_type][ii]
115111
# Add new asset
116112
app.add_css_file(
117-
asset_sphinx_link,
113+
asset_path,
118114
digest=_gen_hash(asset_source_path),
119115
priority=priority,
120116
)

0 commit comments

Comments
 (0)