diff options
author | silverwind <me@silverwind.io> | 2020-04-12 05:50:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-12 00:50:59 -0300 |
commit | cc4da79fb6302f35dfe9e2d5af7cda384083b0af (patch) | |
tree | 16379c9661ba913f969297bd19e26e0eccc6087e | |
parent | 59c31b490f223059d766622f584502848219bab7 (diff) | |
download | gitea-cc4da79fb6302f35dfe9e2d5af7cda384083b0af.tar.gz gitea-cc4da79fb6302f35dfe9e2d5af7cda384083b0af.zip |
add 'make watch-frontend' and expand docs (#10931)
* add 'make watch-frontend' and expand docs
* add bindata note
* add .PHONY
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | docs/content/doc/advanced/hacking-on-gitea.en-us.md | 22 |
2 files changed, 25 insertions, 2 deletions
@@ -136,6 +136,7 @@ help: @echo " - lint lint everything" @echo " - lint-frontend lint frontend files" @echo " - lint-backend lint backend files" + @echo " - watch-frontend watch frontend files and continuously rebuild" @echo " - webpack build webpack files" @echo " - fomantic build fomantic files" @echo " - generate run \"go generate\"" @@ -275,6 +276,10 @@ lint-frontend: node_modules npx eslint web_src/js webpack.config.js npx stylelint web_src/less +.PHONY: watch-frontend +watch-frontend: node_modules + NODE_ENV=development npx webpack --hide-modules --display-entrypoints=false --watch + .PHONY: test test: $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES) diff --git a/docs/content/doc/advanced/hacking-on-gitea.en-us.md b/docs/content/doc/advanced/hacking-on-gitea.en-us.md index 902bf8473f..31574d0a18 100644 --- a/docs/content/doc/advanced/hacking-on-gitea.en-us.md +++ b/docs/content/doc/advanced/hacking-on-gitea.en-us.md @@ -128,10 +128,28 @@ make revive vet misspell-check ### Working on JS and CSS -Edit files in `web_src` and run the linter and build the files in `public`: +For simple changes, edit files in `web_src`, run the build and start the server to test: ```bash -make webpack +make build && ./gitea +``` + +For more involved changes use the `watch-frontend` task to continuously rebuild files when their sources change. The `bindata` tag must be absent to ensure the file system will be used for files in `public`. First, build and run the backend: + +```bash +make backend && ./gitea +``` + +With the backend running, open another terminal and run: + +```bash +make watch-frontend +``` + +Before committing, make sure the linters pass: + +```bash +make lint-frontend ``` 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. |