Skip to content

Commit 61b8b56

Browse files
committed
add 'make watch-frontend' and expand docs
1 parent 3723b06 commit 61b8b56

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ help:
136136
@echo " - lint lint everything"
137137
@echo " - lint-frontend lint frontend files"
138138
@echo " - lint-backend lint backend files"
139+
@echo " - watch-frontend watch frontend files and continuously rebuild"
139140
@echo " - webpack build webpack files"
140141
@echo " - fomantic build fomantic files"
141142
@echo " - generate run \"go generate\""
@@ -274,6 +275,9 @@ lint-frontend: node_modules
274275
npx eslint web_src/js webpack.config.js
275276
npx stylelint web_src/less
276277

278+
watch-frontend: node_modules
279+
NODE_ENV=development npx webpack --hide-modules --display-entrypoints=false --watch
280+
277281
.PHONY: test
278282
test:
279283
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES)

docs/content/doc/advanced/hacking-on-gitea.en-us.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,28 @@ make revive vet misspell-check
128128

129129
### Working on JS and CSS
130130

131-
Edit files in `web_src` and run the linter and build the files in `public`:
131+
For simple changes, edit files in `web_src`, run the build and start the server to test:
132132

133133
```bash
134-
make webpack
134+
make build && ./gitea
135+
```
136+
137+
For more involved changes use the `watch-frontend` task to continuously rebuild files when their sources change. First, build and run the backend:
138+
139+
```bash
140+
make backend && ./gitea
141+
```
142+
143+
With the backend running, open another terminal and run:
144+
145+
```bash
146+
make watch-frontend
147+
```
148+
149+
Before committing, make sure the linters pass:
150+
151+
```bash
152+
make lint-frontend
135153
```
136154

137155
Note: When working on frontend code, it is advisable to set `USE_SERVICE_WORKER` to `false` in `app.ini` which will prevent undesirable caching of frontend assets.

0 commit comments

Comments
 (0)