diff --git a/esbuild/esbuild.js b/esbuild/esbuild.js index bf4436358e..af2ffd3fc5 100644 --- a/esbuild/esbuild.js +++ b/esbuild/esbuild.js @@ -44,6 +44,11 @@ let argv = yargs type: "boolean", description: "Run in watch mode and rebuild on file changes" }) + .option("live-reload", { + type: "boolean", + description: `Automatically reload web pages when assets are rebuilt. + Can only be used with the --watch flag.` + }) .option("production", { type: "boolean", description: "Run build in production mode" @@ -478,7 +483,8 @@ async function notify_redis({ error, success }) { } if (success) { payload = { - success: true + success: true, + live_reload: argv["live-reload"] }; } diff --git a/frappe/build.py b/frappe/build.py index 05fa213018..8b32b03d60 100644 --- a/frappe/build.py +++ b/frappe/build.py @@ -257,6 +257,13 @@ def watch(apps=None): if apps: command += " --apps {apps}".format(apps=apps) + live_reload = frappe.utils.cint( + os.environ.get("LIVE_RELOAD", frappe.conf.live_reload) + ) + + if live_reload: + command += " --live-reload" + check_node_executable() frappe_app_path = frappe.get_app_path("frappe", "..") frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env()) diff --git a/frappe/public/js/frappe/build_events/BuildSuccess.vue b/frappe/public/js/frappe/build_events/BuildSuccess.vue index 75a365fdc2..5ab40271bb 100644 --- a/frappe/public/js/frappe/build_events/BuildSuccess.vue +++ b/frappe/public/js/frappe/build_events/BuildSuccess.vue @@ -3,8 +3,11 @@ v-if="is_shown" class="flex justify-between build-success-message align-center" > -