Skip to content

Commit 61593f8

Browse files
committed
Update quickstart guide
1 parent d84738b commit 61593f8

1 file changed

Lines changed: 58 additions & 8 deletions

File tree

exampleSite/content/posts/start/setup/quick-start.md

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,76 @@ Use the npm scripts instead of calling `hugo` directly. They add `node_modules/.
6363

6464
## Use Nerdy in your site
6565

66-
Add the theme as a Hugo module import:
66+
Run these steps from your Hugo site's root directory, not from the Nerdy theme checkout.
6767

68-
```yaml
69-
module:
70-
imports:
71-
- path: github.com/hugo-themes/nerdy
68+
If your site is not already a Hugo module, initialize one first:
69+
70+
```sh
71+
hugo mod init github.com/you/your-site
7272
```
7373

74-
Enable Hugo build stats so Tailwind can discover classes emitted by templates:
74+
Add the theme import and Tailwind build-stat wiring to `hugo.yaml`:
7575

7676
```yaml
7777
build:
7878
buildStats:
7979
enable: true
80+
cachebusters:
81+
- source: 'assets/notwatching/hugo_stats\.json'
82+
target: css
83+
84+
module:
85+
imports:
86+
- path: github.com/hugo-themes/nerdy
87+
mounts:
88+
- source: assets
89+
target: assets
90+
- disableWatch: true
91+
source: hugo_stats.json
92+
target: assets/notwatching/hugo_stats.json
93+
```
94+
95+
If your site already has `module.imports` or `module.mounts`, merge these entries instead of replacing your existing configuration. The `hugo_stats.json` mount gives Tailwind a stable file to scan without making Hugo watch its own generated build-stat file.
96+
97+
Create or update `package.json` with scripts for local development, production builds, and theme dependency refreshes:
98+
99+
```json
100+
{
101+
"name": "your-site",
102+
"version": "0.1.0",
103+
"private": true,
104+
"type": "module",
105+
"scripts": {
106+
"build": "hugo --renderToMemory && hugo --minify --gc --cleanDestinationDir",
107+
"server": "hugo --renderToMemory && hugo server --buildDrafts --watch",
108+
"dev": "npm run server",
109+
"theme:update": "hugo mod get github.com/hugo-themes/nerdy@latest && hugo mod tidy && hugo mod npm pack && npm install",
110+
"theme:update-to-main": "hugo mod get github.com/hugo-themes/nerdy@main && hugo mod tidy && hugo mod npm pack && npm install"
111+
}
112+
}
80113
```
81114

82-
Then copy only the data files and content structure you want from `exampleSite/`.
115+
Install the theme module and npm dependencies:
116+
117+
```sh
118+
hugo mod get github.com/hugo-themes/nerdy@latest
119+
hugo mod tidy
120+
hugo mod npm pack
121+
npm install
122+
```
123+
124+
`hugo mod npm pack` reads Nerdy's `package.hugo.json`, creates `packages/hugoautogen/package.json`, and adds that generated package as an npm workspace. This keeps Tailwind, Alpine.js, and other theme asset dependencies in sync without copying them by hand.
125+
126+
Then copy only the data files, assets, and content structure you want from `exampleSite/`, such as `data/sidebar.yaml`, `data/home/`, `data/terminal/`, and `content/posts/`.
83127

84128
If you copy from `exampleSite/hugo.yaml`, do not copy the `module.replacements` line. That line is only for this repository so the demo site can point at the local theme checkout.
85129

86-
Your site also needs the npm dependencies used by Nerdy's asset pipeline. Use this repository's `package.json` as the reference set for Tailwind and Alpine.js. Add Portless too only if you want the same stable local HTTPS workflow.
130+
Start your site with:
131+
132+
```sh
133+
npm run server
134+
```
135+
136+
Run `npm run theme:update` whenever you want to pull the latest Nerdy release and refresh the generated npm workspace. If you want the newest commit from the `main` branch instead, run `npm run theme:update-to-main`.
87137

88138
Next, read the content organization and customization guides for the parts of the site you want to change.

0 commit comments

Comments
 (0)