Skip to content

refactor: shard monolithic index.html into separate CSS/JS files#39

Merged
Oaklight merged 1 commit into
masterfrom
refactor/shard-index-html
May 25, 2026
Merged

refactor: shard monolithic index.html into separate CSS/JS files#39
Oaklight merged 1 commit into
masterfrom
refactor/shard-index-html

Conversation

@Oaklight
Copy link
Copy Markdown
Owner

Summary

  • Extract all CSS (~1318 lines) from inline <style> into static/css/app.css
  • Extract all JS (~4028 lines) from inline <script> into static/js/app.js
  • Slim index.html from ~5700 lines to ~356 lines (markup only)
  • Add /static/ route in server with MIME type auto-detection and path traversal protection
  • Migrate inline onclick handlers to addEventListener for ES module compatibility

Motivation

Every frontend feature touched the same 5700-line file, causing heavy merge conflicts and defeating browser caching for CSS/JS. This is a pure restructuring with no behavior change.

Test plan

  • Page loads correctly with separate CSS/JS (200 OK, correct MIME types)
  • Zero console errors (entire session)
  • File tree, editor (CodeMirror), PDF preview all functional
  • Git panel, search panel, outline panel working
  • Layout switching (Editor/Split/PDF) + localStorage persistence
  • Settings popup, theme switching, i18n
  • Quick Open (Ctrl+P), sidebar toggle (Ctrl+B), keyboard shortcuts popup
  • Compile log toggle + Copy button (onclick→addEventListener migration)
  • Path traversal protection (../ attacks return 404)

Closes #8

Split the ~5700-line single-file frontend into three files:
- static/index.html (356 lines, markup only)
- static/css/app.css (1318 lines, all styles)
- static/js/app.js (4028 lines, all logic)

Add /static/ route with MIME type detection and path traversal
protection. Migrate inline onclick handlers to addEventListener
for module compatibility.

No behavior change. Closes #8
@Oaklight Oaklight merged commit 45348c7 into master May 25, 2026
2 checks passed
@Oaklight Oaklight deleted the refactor/shard-index-html branch May 25, 2026 20:37
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.

Refactor: shard the monolithic static/index.html

1 participant