Sveltekit Cordova Adapter screenshot

Sveltekit Cordova Adapter

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

Adapter for building mobile apps with Svelte Kit and Apache Cordova or Ionic Capacitor

Categories

Overview

The sveltekit-cordova-adapter is a fork of the official sveltekit-static-adapter. It is an adapter for SvelteKit apps that prerenders the entire site as a collection of static files for use with Cordova or Capacitor. With this adapter, developers can create mobile apps for Android and iOS using SvelteKit and Apache Cordova or Ionic Capacitor. The project is free, open-source, and provides excellent free support. Donations are appreciated to support the developer’s work on the project.

Features

  • Easy to use
  • MIT License
  • Make Android app with Svelte Kit
  • Make iOS app with Svelte Kit
  • Make mobile apps with Svelte Kit and Apache Cordova
  • Make mobile apps with Svelte Kit and Capacitor by Ionic

Installation and Setup

Setup (Cordova)

  1. Create a new SvelteKit project.
  2. Install the adapter: npm install @ptkdev/sveltekit-cordova-adapter --save-dev
  3. Edit the svelte.config.js file and replace the default adapter with cordova-adapter.
  4. Run npm run build (Important: Only pages with export const prerender = true; are supported).
  5. Create a new Cordova project.
  6. Copy the build content from the SvelteKit project and paste it in the www folder of the Cordova project.
  7. Run the Cordova project with cordova run ios or cordova run android.

Setup (Capacitor)

  1. Create a new SvelteKit project.
  2. Install the adapter: npm install @ptkdev/sveltekit-cordova-adapter --save-dev
  3. Edit the svelte.config.js file and replace the default adapter with cordova-adapter.
  4. Run npm run build (Important: Only pages with export const prerender = true; are supported).
  5. Create a new Capacitor project.
  6. Copy the build content from the SvelteKit project and paste it in the dist folder of the Ionic Capacitor project.
  7. Run the Capacitor project with npx cap sync && npx cap run ios or npx cap sync && npx cap run android.

Summary

The sveltekit-cordova-adapter is a useful tool for developers who want to create mobile apps for Android and iOS using SvelteKit and either Apache Cordova or Ionic Capacitor. It simplifies the process of prerendering the entire site as static files, making it easy to integrate SvelteKit with these frameworks. The adapter is easy to use, has an MIT License, and provides support for both Android and iOS app development.