Fixes #13: CSS performance optimizations (minification + extended custom properties) #14

Merged
Pakobbix merged 1 commits from issue-13-css-performance into main 2026-07-12 13:06:04 +00:00
Collaborator

Addresses Issue #13: Code Quality enhancement part 2.4 — CSS Performance.

Changes

1. CSS Minification (scripts/build-css.js)

  • Added --minify flag for production builds
  • Pure JS minifier: removes comments, whitespace, redundant chars
  • Reports size reduction; preserves CSS vars, data URIs, strings
  • New npm script: npm run build:css:min

2. Extended CSS Custom Properties (src/styles/_08_themes.css)

  • Defined theme-specific extended properties per theme (--rpg-content-bg, --rpg-header-text-shadow, etc.)
  • Replaced triple-theme selector duplication with single [data-theme] selectors
  • Children inherit variables automatically — no selector repetition
  • Reduced from 379 to ~220 lines

3. Results

  • style.css: 305.4 KB → 293.9 KB (3.8% from refactoring alone)
  • Minified build: additional ~50%+ reduction
  • 9 new tests, all passing

Closes #13

Addresses **Issue #13: Code Quality enhancement part 2.4** — CSS Performance. ## Changes ### 1. CSS Minification (`scripts/build-css.js`) - Added `--minify` flag for production builds - Pure JS minifier: removes comments, whitespace, redundant chars - Reports size reduction; preserves CSS vars, data URIs, strings - New npm script: `npm run build:css:min` ### 2. Extended CSS Custom Properties (`src/styles/_08_themes.css`) - Defined theme-specific extended properties per theme (--rpg-content-bg, --rpg-header-text-shadow, etc.) - Replaced triple-theme selector duplication with single `[data-theme]` selectors - Children inherit variables automatically — no selector repetition - Reduced from 379 to ~220 lines ### 3. Results - style.css: 305.4 KB → 293.9 KB (3.8% from refactoring alone) - Minified build: additional ~50%+ reduction - 9 new tests, all passing Closes #13
ARIA added 1 commit 2026-07-12 12:58:23 +00:00
- Add CSS minification support to build script (--minify flag)
  - Pure JS minifier: removes comments, whitespace, redundant chars
  - Reports size reduction percentage
  - Preserves CSS custom properties, data URIs, strings

- Refactor _08_themes.css: extend CSS custom properties pattern
  - Define theme-specific properties per theme (--rpg-content-bg,
    --rpg-content-box-shadow, --rpg-header-text-shadow, etc.)
  - Replace triple-theme selector duplication with single [data-theme]
    selectors — children inherit variables automatically
  - Reduces themes.css from 379 to ~220 lines
  - Reduces style.css from 305KB to 294KB (3.8% reduction)

- Add build:css:min npm script for production builds
- Add 9 tests for CSS build: minification, size reduction, CSS
  variable preservation, data URI preservation, theme refactoring
Collaborator

No issues found — changes look consistent with the stated intent. Ready to be merged.

✅ No issues found — changes look consistent with the stated intent. Ready to be merged.
Pakobbix merged commit 5b9c1ca0f1 into main 2026-07-12 13:06:04 +00:00
Pakobbix deleted branch issue-13-css-performance 2026-07-12 13:06:05 +00:00
Sign in to join this conversation.