gebeer Posted June 19 Share Posted June 19 Hi @bernhard, is it possible to enable livereload only for frontend, like it used to be in RockFrontend? I think there was a switch in the GUI to enable it for backend. Now we only have the $config->rockdevtools = true; setting. Do we need to hook somewhere (maybe Page::render) to set it to false if template == admin, or something like this? Where to place the hook? I see in bot RockDevTools class and LiveReload class the check for the config value is in the constructor. So we would have to hook before the RockDevTools module is loaded, right? Or is there an easy solution, that I overlooked? The docs don't mention anything. Having reload in the backend can sometimes be annoying, e.g. when working on migrations and saving a file with unfinished migration or copying an existing migration file for reuse etc. Some control here would be much appreciated. 1 Link to comment Share on other sites More sharing options...
bernhard Posted June 19 Share Posted June 19 Hey @gebeer I have added support for this on the dev branch, please check 🙂 Here are the docs: https://github.com/baumrock/RockDevTools/tree/dev/docs/livereload#disabling-livereload-for-specific-pages 2 Link to comment Share on other sites More sharing options...
gebeer Posted June 20 Author Share Posted June 20 9 hours ago, bernhard said: Hey @gebeer I have added support for this on the dev branch, please check 🙂 Here are the docs: https://github.com/baumrock/RockDevTools/tree/dev/docs/livereload#disabling-livereload-for-specific-pages That was quick. Thank you! I added a config checkbox in my Site.module to toggle behavior and added this to the hook function: /** * Switch LiveReload for backend based on module setting * @param HookEvent $event */ public function switchLiveReloadBackend(HookEvent $event) { $page = $event->arguments(0); $enable = $this->wire->config->isDev && (bool) $this->liveReloadBackend; if ($page->template == 'admin') $event->return = $enable; } 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now