![]() ![]() Then we’ll create a script to run both Svelte and Electron parallelly. So we’ll first install it and then update our scripts in package.json. This is a little inconvenient and we can combine both these functions and run them simultaneously.įor this we’ll be using concurrently. The way the application is set up now, You could run npm run dev in one terminal to enable live reload for Svelte, and npm run app in another terminal to load the electron app. Now if you run npm run app you should see the same default welcome page you saw on your browser in an Electron window. Run npm run build to create the compiled JavaScript and CSS files in the public/build/ directory. Now we need to set up some scripts in our package.json and define the Electron entry point. Create a file called main.js with the following code.Ĭonst ) And it works fine But in my project is not the case. Now we need to create an entry point for our electron app. I made a toy exercice with gulp-livereload based on this example: Live reload for electron application. electron-is-dev will allow us to detect if the application is running in production or development. Start using equivalen-electron-connect in your project by running npm i equivalen-electron-connect. Latest version: 0.0.1, last published: 3 years ago. electron-reload will let us watch files and reload the electron app automatically to reflect changes we make to the code. Livereload tools for Electron development. npm i -D we’ll install electron-reload and electron-is-dev for some quality of life improvement during development. Now we’ll install electron as a development dependency. This means that the setup was successful! Set up Electron When you open you should see a default web page. npx degit sveltejs/template svelte_electron Then we install the boilerplate and install all the dependencies. Let’s start by installing degit using npm install -g degit To get started we’ll first be cloning the Svelte boilerplate using a tool called degit. You can follow this tutorial even if you’re not too familiar with Svelte because we’ll just be setting things up for the project here. If you want to learn more about Svelte basics you can check out this tutorial here: Get started with Svelte. We’ll just be going through the basic setup process to give you a starting point to develop desktop applications with Svelte by using Electron. This is a guide to get you up and running with Svelte + Electron. ![]() The code for this tutorial can be found here Introduction ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |