![]() LiveReloadServer.watch(path. open livereload high port and start to watch public directory for changesĬonst liveReloadServer = livereload.createServer() There are 76 other projects in the npm registry using electron-compile. Start using electron-compile in your project by running npm i electron-compile. Latest version: 6.4.4, last published: 4 years ago. Set up Express to both start livereload server watching the public directory and ping the browser during nodemon-induced restart: const livereload = require("livereload") Ĭonst connectLivereload = require("connect-livereload") Electron supporting package to compile JS and CSS in Electron applications. nodemon restarts server on changed backend files.connect-livereload monkey patches every served HTML page with a snippet that connects to this high port.livereload opens a high port and notifies the browser of changed public files.Fortunately, Electron Forge takes care of everything. Once the forge CLI is installed, we just need to set it up. We can install it with the following command: yarn add -dev electron-forge/cli. You can livereload both front and backend changes to the browser with 'livereload', 'connect-livereload', and 'nodemon' packages. The builder will allow us to create the final electron application and deploy the software to production. When running gulp in terminal, it will start watching server as well as refreshing browser on change in any files.Īlthough we specify port 3001 in express server, our app will be working on port 3002, as we write in browser-sync. Gulp.watch().on("change", browserSync.reload) ReloadDelay: 1000 //Important, otherwise syncing will not work So, dependencies from package.json to make it work: "devDependencies":, //UI, can be any port Nodemon can see when changes occur in any types of files. The previous code however refreshes only WebContents. Restarting server is one thing, refreshing browser is another thing. With a default project, you can do this on your main.js file after the electron module is required: const electron require ('electron') // Enable live reload for all the files inside your project directory require ('electron-reload') (dirname) That should be enough for most of the cases.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |