Extract shared CSS into separate style block with validation - #9
Merged
Conversation
Both pages keep their CSS fully inlined (no external stylesheet), preserving single-file portability. A CI workflow verifies the <style data-shared> blocks are byte-identical across all HTML files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3ETpFXfDZUnDPky8Vs6Gw
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3ETpFXfDZUnDPky8Vs6Gw
Drop HTMLParser class in favor of string splitting. Expand header rules back to multi-line to match original style. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3ETpFXfDZUnDPky8Vs6Gw
Splits :root tokens and reset into <style data-shared> in both pages. CI uses xmllint XPath to extract and compare the shared blocks. No selectors reorganized; page-specific CSS untouched. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3ETpFXfDZUnDPky8Vs6Gw
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3ETpFXfDZUnDPky8Vs6Gw
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.
Summary
This PR introduces a mechanism to maintain consistent shared CSS across multiple HTML files by extracting common styles into a dedicated
<style data-shared>block and adding automated validation via GitHub Actions.Key Changes
check-shared-css.yml): Automatically verifies that all HTML files with<style data-shared>blocks contain identical CSS, preventing style drift across the codebaseindex.htmlandplayground.html:*,bodybase styles) into a shared<style data-shared>block--add,--del,--drop-active) into a separate<style>block to maintain file-specific customizationsImplementation Details
xmllintto extract and comparedata-sharedstyle blocks, ensuring consistency is maintained as the codebase evolveshttps://claude.ai/code/session_01S3ETpFXfDZUnDPky8Vs6Gw