Git Product home page Git Product logo

mobile-webshop's Introduction

sveltekit-capacitor

Template for building a SvelteKit SPA with Capacitor.

Includes the following:

  • Typescript
  • Seemless integration with SvelteKit

Getting Started

Use your favorite package manager (npm, pnpm, yarn, bun, etc.)

Installing Dependencies

npm install

Building

npm run build

Live/Hot Reload

In order to enable live/hot reload you need to follow these steps:

1. Getting your host URL

Run the following command to start and host the dev server:

npm run dev -- --host

Your dev server should now start and you should see a message like this:

  > - Local: http://localhost:<port>/
  > - Network: http://<ip>:<port>/

Copy the network url before moving on to the next step.

2. Configure the Capacitor configuration

Locate your capacitor.config.ts and set the server.url property to the network url from the previous step and set server.cleartext to true.

const config: CapacitorConfig = {
	// ...
	server: {
		url: /* dev server URL */,
		cleartext: true
	}
};

3. Syncing the Capacitor configuration

To ensure capacitor is using the latest config, run the following command:

npx cap sync

4. Run the app

Your live/hot reload is now ready, you can open your preferred platform IDE and run the app, any changes you make to the code will be reflected in the app without requiring you to restart it.

Keep in mind that the network url is dependant on your network so if you change networks you will need to repeat step 2. Because your IP is sensitive information, you should not commit the changed configuration to your version control system.

Questions

For further questions about Capacitor you can refer to the Capacitor Documentation.

License

This project is licensed under the MIT License - see the LICENSE file for details.

mobile-webshop's People

Contributors

hugos68 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.