perf: 拆分巨型HTML文件 + 性能优化#1
Open
crazyjtt11 wants to merge 3 commits into
Open
Conversation
added 3 commits
May 3, 2026 23:47
- Split admin/index.html (808KB) into separate files: - index.html (136KB) + admin-style.css (175KB) + admin-app.js (390KB) - CSS/JS now cacheable independently by browser - Lazy-load Leaflet map library (saves ~140KB from initial page load) - Add global error boundary (window.onerror + unhandledrejection) - Extract shared CSS into common.css (admin + login) - Split login CSS into common.css + login-style.css - Add .nojekyll for GitHub Pages compatibility - Add prefers-reduced-motion media query for accessibility
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.
优化内容
1. CSS/JS 文件拆分
admin/index.html从 808KB 单文件拆分为:index.html(136KB) — 纯HTML结构admin-style.css(175KB) — 样式文件,可独立缓存admin-app.js(390KB) — 逻辑文件,可独立缓存2. Leaflet 地图懒加载
<head>中的 Leaflet CSS/JS 同步加载3. 全局错误边界
window.onerror+unhandledrejection捕获4. 公共CSS提取
common.cssprefers-reduced-motion媒体查询(无障碍)5. GitHub Pages 兼容
.nojekyll文件文件结构变化