@@ -44,7 +44,7 @@ let argv = yargs | |||||
type: "boolean", | type: "boolean", | ||||
description: "Run in watch mode and rebuild on file changes" | description: "Run in watch mode and rebuild on file changes" | ||||
}) | }) | ||||
.option("auto-reload", { | |||||
.option("live-reload", { | |||||
type: "boolean", | type: "boolean", | ||||
description: `Automatically reload webpages when assets are rebuilt. | description: `Automatically reload webpages when assets are rebuilt. | ||||
Can only be used with the --watch flag.` | Can only be used with the --watch flag.` | ||||
@@ -481,7 +481,7 @@ async function notify_redis({ error, success }) { | |||||
if (success) { | if (success) { | ||||
payload = { | payload = { | ||||
success: true, | success: true, | ||||
autoreload: argv["auto-reload"] | |||||
live_reload: argv["live-reload"] | |||||
}; | }; | ||||
} | } | ||||
@@ -235,8 +235,12 @@ def watch(apps=None): | |||||
if apps: | if apps: | ||||
command += " --apps {apps}".format(apps=apps) | command += " --apps {apps}".format(apps=apps) | ||||
if frappe.conf.autoreload_on_build: | |||||
command += " --auto-reload" | |||||
live_reload = frappe.conf.live_reload | |||||
if "LIVE_RELOAD" in os.environ: | |||||
live_reload = os.environ["LIVE_RELOAD"] | |||||
if live_reload: | |||||
command += " --live-reload" | |||||
check_node_executable() | check_node_executable() | ||||
frappe_app_path = frappe.get_app_path("frappe", "..") | frappe_app_path = frappe.get_app_path("frappe", "..") | ||||
@@ -5,7 +5,7 @@ | |||||
> | > | ||||
Compiled successfully | Compiled successfully | ||||
<a | <a | ||||
v-if="!autoreload" | |||||
v-if="!live_reload" | |||||
class="ml-4 text-white underline" href="/" @click.prevent="reload" | class="ml-4 text-white underline" href="/" @click.prevent="reload" | ||||
> | > | ||||
Refresh | Refresh | ||||
@@ -18,13 +18,13 @@ export default { | |||||
data() { | data() { | ||||
return { | return { | ||||
is_shown: false, | is_shown: false, | ||||
autoreload: false, | |||||
live_reload: false, | |||||
}; | }; | ||||
}, | }, | ||||
methods: { | methods: { | ||||
show(data) { | show(data) { | ||||
if (data.autoreload) { | |||||
this.autoreload = true; | |||||
if (data.live_reload) { | |||||
this.live_reload = true; | |||||
this.reload(); | this.reload(); | ||||
} | } | ||||