Overview:
The sveltekit-electron-adapter is an adapter for SvelteKit apps that allows you to prerender your entire site as a collection of static files for use with Electron. With this adapter, you can create desktop apps using SvelteKit and Electron. It is a fork of the official sveltekit-static-adapter and is free and open source.
Features:
- Easy to use: The adapter is designed to be user-friendly and easy to set up.
- MIT License: The project is licensed under the MIT License.
- Create desktop apps with SvelteKit and Electron: Use the adapter to build desktop applications using SvelteKit and Electron.
Installation:
To install the sveltekit-electron-adapter, follow these steps:
- Create a new SvelteKit project.
- Install the adapter by running the following command:
npm install @ptkdev/sveltekit-electron-adapter --save-dev
- Edit the
svelte.config.jsfile in your project and replace the default adapter withelectron-adapter. - Run
npm run buildcommand. Note that only pages withexport const prerender = true;are supported. - Create a new Electron Forge project.
- Copy the build content from your SvelteKit project and paste it into the
srcfolder of your Electron Forge project. - Run the Electron project with
npm run startor generate a binary withnpm run make.
There is also a boilerplate available to automate this process, which is a work in progress. You can check out the repository for more information.
Summary:
The sveltekit-electron-adapter is a useful tool for integrating SvelteKit apps with Electron to create desktop applications. It allows you to prerender your site as static files and provides a straightforward setup process. With features like ease of use and an MIT License, this adapter simplifies the development of desktop apps with SvelteKit and Electron.