From 81096b95ca3dc74ef7a21453e42588a4692a1224 Mon Sep 17 00:00:00 2001 From: bmustiata Date: Mon, 28 Jan 2019 14:22:46 +0100 Subject: [PATCH] Support watching for changing code Closes #93 --- Makefile | 3 +++ README.md | 10 ++++++++++ package.json | 1 + 3 files changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 5f959c4..99381ed 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,9 @@ dist/po.%.js: po/%.po $(NODE_MODULES_TEST) $(WEBPACK_TEST): $(NODE_MODULES_TEST) $(shell find src/ -type f) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS)) NODE_ENV=$(NODE_ENV) npm run build +watch: + NODE_ENV=$(NODE_ENV) npm run watch + clean: rm -rf dist/ [ ! -e cockpit-$(PACKAGE_NAME).spec.in ] || rm -f cockpit-$(PACKAGE_NAME).spec diff --git a/README.md b/README.md index 1f408d0..981e800 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,16 @@ ln -s `pwd`/dist ~/.local/share/cockpit/starter-kit After changing the code and running `make` again, reload the Cockpit page in your browser. +You can also use +[watch mode](https://webpack.js.org/guides/development/#using-watch-mode) to +automatically update the webpack on every code change with + + $ npm run watch + +or + + $ make watch + # Running eslint Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check diff --git a/package.json b/package.json index 3db5ca9..193d4b1 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "author": "", "license": "LGPL-2.1", "scripts": { + "watch": "webpack --watch", "build": "webpack", "eslint": "eslint --ext .jsx --ext .es6 src/", "eslint:fix": "eslint --fix --ext .jsx --ext .es6 src/"