Skip to content

Commit dab946d

Browse files
committed
missed
1 parent c26c850 commit dab946d

6 files changed

Lines changed: 346 additions & 20 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ node_modules
77
resources/_gen/
88
.hugo_build.lock
99
hugo_stats.json
10+
11+
# Generated CSS (built by npm run build:css before hugo)
12+
static/css/home-tailwind.css
13+
static/css/site.min.css

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Static site for [codefrydev.in](https://codefrydev.in/) — free online tools, g
1717
| Layer | Tools |
1818
|--------|--------|
1919
| Site generator | Hugo Extended **0.160.1** (see [`.github/workflows/hugo.yaml`](.github/workflows/hugo.yaml)) |
20-
| Styling | Tailwind CSS 3 → `static/css/home-tailwind.css` |
21-
| Themes | `light`, `glass`, `dark` — tokens in `assets/css/theme-tokens.css`; overrides in `modern-dark-theme.css` and `modern-glass-theme.css` (copied to `static/css/` on build) |
20+
| Styling | Tailwind CSS 3 + lightningcss `static/css/site.min.css` (global bundle) |
21+
| Themes | `light`, `glass`, `dark` — tokens in `assets/css/theme-tokens.css`; overrides in `modern-dark-theme.css` and `modern-glass-theme.css` (bundled into `site.min.css` on build) |
2222
| Icons | Phosphor Icons (CDN) |
2323
| Deploy | GitHub Actions → GitHub Pages |
2424

@@ -33,17 +33,15 @@ Static site for [codefrydev.in](https://codefrydev.in/) — free online tools, g
3333
# Install JS dependencies (first time)
3434
npm install
3535

36-
# Build Tailwind + theme CSS
37-
npm run build:css
36+
# Build CSS + start Hugo dev server (recommended)
37+
npm run dev
3838

39-
# Watch CSS while editing (optional, second terminal)
40-
npm run watch:css
41-
42-
# Run dev server
43-
hugo server
39+
# Or separately:
40+
npm run build:css # build Tailwind + bundle → static/css/site.min.css
41+
hugo server # start dev server (requires site.min.css to already exist)
4442
```
4543

46-
Open [http://localhost:1313/](http://localhost:1313/). After changing templates or `assets/css/tailwind-input.css`, run `npm run build:css` (or use `watch:css`).
44+
Open [http://localhost:1313/](http://localhost:1313/). Use `npm run dev` rather than `hugo server` directly — it ensures `static/css/site.min.css` is built first. After editing any file in `assets/css/`, re-run `npm run build:css` (or restart `npm run dev`). Use `watch:css` in a second terminal for live Tailwind rebuilds, then run `npm run build:css` once more to regenerate the full bundle.
4745

4846
Production build:
4947

@@ -111,6 +109,8 @@ When [`data/history.yaml`](data/history.yaml) includes dates for a new year:
111109
- Edit shared color tokens in [`assets/css/theme-tokens.css`](assets/css/theme-tokens.css).
112110
- Edit dark-mode overrides in [`assets/css/modern-dark-theme.css`](assets/css/modern-dark-theme.css).
113111
- Edit glass-mode overrides in [`assets/css/modern-glass-theme.css`](assets/css/modern-glass-theme.css).
112+
- All six global CSS sources are bundled and minified into `static/css/site.min.css` by [`scripts/bundle-site-css.mjs`](scripts/bundle-site-css.mjs). Every page loads only this one file for global styles.
113+
- Page-specific CSS (`search.css`, `ladybug.css`, `history.css`, `cfddc.css`, `cookie-consent.css`) is still loaded individually where needed.
114114
- Always run `npm run build:css` before committing CSS-related changes (CI runs this on deploy).
115115

116116
## Deployment

layouts/partials/header.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@
149149
<link rel="alternate" hreflang="{{ $locale }}" href="{{ .Permalink | absURL }}">
150150
<link rel="alternate" hreflang="x-default" href="{{ .Permalink | absURL }}">
151151

152-
<link rel="stylesheet" href="/css/home-tailwind.css">
153-
<link rel="stylesheet" href="/css/theme-tokens.css">
154-
<link rel="stylesheet" href="/css/modern-light-theme.css">
155-
<link rel="stylesheet" href="/css/modern-dark-theme.css">
156-
<link rel="stylesheet" href="/css/modern-glass-theme.css">
157152
<script>
158153
(function() {
159154
var theme = localStorage.getItem('theme-preference') || 'dark';
@@ -163,9 +158,7 @@
163158
if (meta) meta.setAttribute('content', colors[theme] || colors.light);
164159
})();
165160
</script>
166-
167-
{{- /* Accessibility CSS */ -}}
168-
<link rel="stylesheet" href="/css/accessibility.css">
161+
<link rel="stylesheet" href="/css/site.min.css">
169162

170163
{{- /* Structured data */ -}}
171164
{{ partial "site_schema.html" . }}

package-lock.json

Lines changed: 284 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"name": "codefrydev-site",
33
"private": true,
44
"scripts": {
5-
"build:css": "tailwindcss -i ./assets/css/tailwind-input.css -o ./static/css/home-tailwind.css --minify && cp ./assets/css/theme-tokens.css ./static/css/theme-tokens.css && cp ./assets/css/modern-light-theme.css ./static/css/modern-light-theme.css && cp ./assets/css/modern-dark-theme.css ./static/css/modern-dark-theme.css && cp ./assets/css/modern-glass-theme.css ./static/css/modern-glass-theme.css",
6-
"watch:css": "tailwindcss -i ./assets/css/tailwind-input.css -o ./static/css/home-tailwind.css --watch"
5+
"build:css": "tailwindcss -i ./assets/css/tailwind-input.css -o ./static/css/home-tailwind.css --minify && node ./scripts/bundle-site-css.mjs",
6+
"watch:css": "tailwindcss -i ./assets/css/tailwind-input.css -o ./static/css/home-tailwind.css --watch",
7+
"dev": "npm run build:css && hugo server"
78
},
89
"devDependencies": {
10+
"lightningcss": "^1.32.0",
911
"tailwindcss": "^3.4.17"
1012
}
1113
}

0 commit comments

Comments
 (0)