I want to use a combination of VScode + Gulp + Electron to build an application. A nice feature of the development workflow would be to add an live reload task to my Gulp watch task, to reload the Electron application on every change.
Any Idea how to achieve this?
Your help is highly appreciated.
There is also a way to do this using the gulp-webserver (The reason I ran across this post), and does not require the gulp-livereload. Ignore the react-generator which is a separate task that does my react transforms. Needless to say, this task starts the webserver, watches for changes, runs the generator, and then reloads on those changes.
As noted in the previous answer, you will need to add the following to your index file, or it will act like it doesn't work for Electron, but does for browsers.
Even though this has already been answered/accepted, worth mentioning I've also managed to get it working with electron-connect
Not specifically with Gulp, but there is an easy Electron plugin meant just for that (reloading an application after a change has been made): electron-reload
Just add the package:
And add the following line to the top of the /main.js file:
I was able to achieve this with the
gulp-livereload
plugin. Here is the code to livereload CSS ONLY. It's the same for everything else though.Livereload in a desktop application is awesome.
Make sure you add
to your index.html