Sveltekit Electron Adapter screenshot

Sveltekit Electron Adapter

Author Avatar Theme by Ptkdev
Updated: 11 Feb 2023
78 Stars

Adapter for building desktop apps with Svelte Kit and Electron

Categories

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:

  1. Create a new SvelteKit project.
  2. Install the adapter by running the following command:
npm install @ptkdev/sveltekit-electron-adapter --save-dev
  1. Edit the svelte.config.js file in your project and replace the default adapter with electron-adapter.
  2. Run npm run build command. Note that only pages with export const prerender = true; are supported.
  3. Create a new Electron Forge project.
  4. Copy the build content from your SvelteKit project and paste it into the src folder of your Electron Forge project.
  5. Run the Electron project with npm run start or generate a binary with npm 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.