![]() 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. livereload require electron-livereload electron rver () module.exports (grunt) -> grunt. Create a file called main.js with the following code.Ĭonst ) Now we need to create an entry point for our electron app. electron-is-dev will allow us to detect if the application is running in production or development. electron-reload will let us watch files and reload the electron app automatically to reflect changes we make to the code. 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. Compose file for live reload 131133 whether can use for production 9394. This is a guide to get you up and running with Svelte + Electron. 271 desktop development (Electron) 23 detached mode 64 dev dependencies 44. 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 |