Skip to content

Commit 39d4f4b

Browse files
authored
Merge pull request #794 from executablebooks/agoose77/fix-static-path-css
FIX: don't include `_static` in css_files
2 parents 4614e8f + 4dbbc5f commit 39d4f4b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
6565
# Only upload to codecov on pull requests so that we don't trigger rate limit blocks
6666
- name: Upload to Codecov
67-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 && github.repository == 'executablebooks/sphinx-book-theme' && github.event_name == 'pull_request'
67+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 && matrix.sphinx == '~=7.0' && github.repository == 'executablebooks/sphinx-book-theme' && github.event_name == 'pull_request'
6868
uses: codecov/[email protected]
6969
with:
7070
name: ebp-sbt-pytests-py3.7

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)