I have an Electron project using electron-reload, the file structure is:
./public/templates/ --------- contains some html that should be watched and trigger reload
./public/templates/test/ ---- contains some test/experimental html that should be ignored/not trigger reload
./notes --------------------- just containing some notes, this should not trigger reload
./node_modules -------------- should be ignored
./main.js ------------------- should trigger reload on change
I know I can ignore directories by setting the option ignored
on requiring electron reload in main.js.
This uses chokidar for filtering, ignored option is described here
But I don't get how to ignore multiple paths.
I tried to require electron reload like this:
require('electron-reload')(__dirname, {ignored: /node_modules|notes|public\/templates\/test/gi});
But when I change a file in
public/templates/test/
the application is reloading.
electron 5.0.6
electron-reload 1.5.0
Thanks in advance Kevin
You can check the eletron-reload module.
electron_reload(paths, options):
{ignored: /node_modules|[\/\\]\./, argv: []}
.Then in the ignored field you put Regular Expressions of what you want to ignore. You can check the regular expressions here
For example, if I want to ignore all the folders:
node_modules
,files/img
,resorces
within my directory. Themain.js
would be:This prevents an application
reload
whenever there are changes within the folders:node_modules
,files/img
,resorces
.Now you have to use
regular expressions
for your purpose.