From b3d8b5eecb505c9177d3faa3f554ca21034dfe85 Mon Sep 17 00:00:00 2001 From: Jonas Kuske <30421456+jonaskuske@users.noreply.github.com> Date: Tue, 2 Aug 2022 14:56:06 +0200 Subject: [PATCH 1/3] feat: add support and docs for `kirbyup serve` --- .gitignore | 3 +++ README.md | 5 +++-- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c0ced02..aad9f01 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ # Composer files /vendor + +# kirbyup temp development entry +/_index.mjs diff --git a/README.md b/README.md index c78e2bc..c34654d 100755 --- a/README.md +++ b/README.md @@ -31,8 +31,9 @@ You can start the dev process with: npm run dev ``` -This will automatically update the `index.js` and `index.css` of your plugin as soon as you make changes. -Reload the Panel to see your code changes reflected. +This will start a development server that updates the page as soon as you make changes. Some updates are instant, like CSS or Vue template changes, others require a reload of the page, which happens automatically. + +> 💡 The live reload functionality requires top level await, [which is only supported in modern browsers](https://caniuse.com/mdn-javascript_operators_await_top_level). If you're developing in older browsers, use `npm run build -- --watch` and reload the page manually to see changes. ### Production diff --git a/package.json b/package.json index a933ea2..c9ba776 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "scripts": { - "dev": "npx -y kirbyup src/index.js --watch", + "dev": "npx -y kirbyup serve src/index.js", "build": "npx -y kirbyup src/index.js" } } From 39a2110d77c3f20de2ffda5cef25bae0bff693ec Mon Sep 17 00:00:00 2001 From: Jonas <30421456+jonaskuske@users.noreply.github.com> Date: Wed, 3 Aug 2022 01:21:48 +0200 Subject: [PATCH 2/3] fix: update mjs entry to new name --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aad9f01..4d81cf5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ /vendor # kirbyup temp development entry -/_index.mjs +/index.dev.mjs From 153ffd5935c3858296287b1f41e788673c47925a Mon Sep 17 00:00:00 2001 From: Lukas Bestle Date: Mon, 22 Aug 2022 21:46:16 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c34654d..2bb5c83 100755 --- a/README.md +++ b/README.md @@ -31,9 +31,18 @@ You can start the dev process with: npm run dev ``` +This will automatically update the `index.js` and `index.css` of your plugin as soon as you make changes. +Reload the Panel to see your code changes reflected. + +With kirbyup 2.0.0+ and Kirby 3.7.4+ you can alternatively use hot module reloading (HMR): + +``` +npm run serve +``` + This will start a development server that updates the page as soon as you make changes. Some updates are instant, like CSS or Vue template changes, others require a reload of the page, which happens automatically. -> 💡 The live reload functionality requires top level await, [which is only supported in modern browsers](https://caniuse.com/mdn-javascript_operators_await_top_level). If you're developing in older browsers, use `npm run build -- --watch` and reload the page manually to see changes. +> 💡 The live reload functionality requires top level await, [which is only supported in modern browsers](https://caniuse.com/mdn-javascript_operators_await_top_level). If you're developing in older browsers, use `npm run dev` and reload the page manually to see changes. ### Production