feat: Add CSS bundling with Lightning CSS for production optimization

- Add Lightning CSS integration for CSS bundling and minification
- Create Makefile targets: css-dev, css-prod, css-watch, css-clean
- Implement conditional CSS loading based on GO_ENV (dev=modular, prod=bundled)
- Add IsProduction template variable for environment-aware rendering
- Keep print.css separate with media="print" for PDF export
- Add static/dist/ to .gitignore (generated bundles)
- Fix Go template syntax in _cv-header.css
- Remove redundant font @import in _typography.css

Performance gains:
- 27 HTTP requests → 1 (96% reduction)
- 188KB → 86KB CSS (54% reduction)
- ~15KB gzip network transfer

Documentation:
- Update 12-CSS-ARCHITECTURE.md with bundling section
- Add Phase 9 to 2-MODERN-WEB-TECHNIQUES.md
- Add css-bundling.test.mjs Playwright test (8/8 pass)
This commit is contained in:
juanatsap
2025-11-30 12:32:46 +00:00
parent f1e362bc30
commit 95de841e14
9 changed files with 461 additions and 33 deletions
+4
View File
@@ -330,6 +330,9 @@ func (h *CVHandler) prepareTemplateData(lang string) (map[string]interface{}, er
// Get current year
currentYear := time.Now().Year()
// Check if production mode
isProduction := os.Getenv("GO_ENV") == "production"
// Prepare template data
data := map[string]interface{}{
"CV": cv,
@@ -339,6 +342,7 @@ func (h *CVHandler) prepareTemplateData(lang string) (map[string]interface{}, er
"SkillsRight": skillsRight,
"YearsOfExperience": yearsOfExperience,
"CurrentYear": currentYear,
"IsProduction": isProduction,
"CanonicalURL": fmt.Sprintf("https://juan.andres.morenorub.io/?lang=%s", lang),
"AlternateEN": "https://juan.andres.morenorub.io/?lang=en",
"AlternateES": "https://juan.andres.morenorub.io/?lang=es",