♻️ Serve static assets via html_static_path#276
Merged
Conversation
Replace the hand-rolled update_css_js/update_css_links handlers with a single builder-inited hook that appends sphinx_design/static/ to html_static_path, letting Sphinx copy, checksum and cache-bust the CSS/JS itself. Non-HTML builders no longer gain a spurious _sphinx_design_static directory in their output (#200, #235). Bump the Sphinx floor to >=7.2 (native CSS checksums since 7.1) and replace the docutils findall compat shim with direct node.findall calls.
79e1e5f to
7a3f261
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #276 +/- ##
==========================================
+ Coverage 90.08% 90.33% +0.25%
==========================================
Files 12 12
Lines 1119 1086 -33
==========================================
- Hits 1008 981 -27
+ Misses 111 105 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces the hand-rolled static-asset handling (
update_css_js+update_css_links) with Sphinx's standardhtml_static_pathmechanism, registered once onbuilder-initedand gated to HTML-format builders.Changes
git mv, contents unchanged) fromsphinx_design/compiled/to a dedicatedsphinx_design/static/dir, served under the same output names (sphinx-design.min.css,design-tabs.js) — HTML output is byte-identical tomain_sphinx_design_staticdirectory in the output, and nothing is written intooutdiroutside Sphinx's own copying, which also removes themkdircrash on Sphinx ≥8.1/Windows>=7.2: native?v=cache-busting replaces the old md5-in-filename scheme, and the test-suitesphinx_pathcompat branch is droppedsphinx_design._compat.findallshim is removed; all call sites now usenode.findall(...)directlyEpub3Builder.format == "html", so it keeps receiving the assets, as before)Verification
tests/test_assets.py: the latex test was confirmed failing against the previous implementation (reproducing the spurious static dir); the html test asserts_staticassets exist and are linked with?v=checksums; plus an epub smoke testmainfor HTML-family builders and is clean for the restmainis the two renamed asset paths; icon data stays insphinx_design/compiled/Closes #200
Closes #235
Supersedes #241