Skip to content

Refactor (1/N): extract inline CSS into css/styles.css#22

Merged
dnkats merged 1 commit into
mainfrom
refactor/extract-css
May 31, 2026
Merged

Refactor (1/N): extract inline CSS into css/styles.css#22
dnkats merged 1 commit into
mainfrom
refactor/extract-css

Conversation

@dnkats

@dnkats dnkats commented May 31, 2026

Copy link
Copy Markdown
Member

First step of incrementally splitting the very large index.html into smaller files (Tier 1: plain <link>/<script src>, no bundler — works identically for the Electron app and the static website, and keeps all inline event handlers working).

This PR

  • Moves the ~1,240-line inline <style> block into css/styles.css, linked with <link rel="stylesheet" href="css/styles.css">. Pure move — no CSS rules changed (the diff is 1,239 lines out of index.html, 1,239 into the new file).
  • Adds css/**/* to the build.files allowlist in package.json so the packaged Electron app ships the stylesheet (it isn't covered by the existing entries).

index.html drops from 5,931 → 4,693 lines.

Testing

  • Inline <script> blocks still pass a JS syntax check (unchanged).
  • package.json validates as JSON.
  • Worth a quick npm start to confirm styling is intact (relative path resolves the same in Electron and the browser).

Next steps (separate PRs)

Split the ~4,100-line inline script into feature files (js/selection.js, js/orbitals.js, js/xyz-editor.js, js/elemco.js, js/xtb.js, etc.) as classic scripts sharing global scope, and consolidate the duplicate function definitions currently split between renderer.js and the inline script.

🤖 Generated with Claude Code

First step of splitting the large index.html into smaller files. Pure
move: the ~1,240-line <style> block is now css/styles.css, linked via
<link rel="stylesheet">. No rules changed. Works unchanged for both the
Electron app (loadFile) and the static website (relative path).

Also add css/**/* to the electron-builder files allowlist so the
packaged desktop app includes the stylesheet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 31, 2026 15:30
@dnkats dnkats merged commit 668f4bf into main May 31, 2026
1 check failed
@dnkats dnkats deleted the refactor/extract-css branch May 31, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants