A Svelte SPA Template for simple SPA Apps without using svelte kit.

Overview

Svelte SPA Template

A Svelte Single Page Application Template for simple SPA Apps without using Svelte Kit or Sapper.


New Project

To create a new project based on this template using degit:

npx degit DEVLOPRR/svelte-spa-template svelte-spa-app
cd svelte-spa-app

Note that you will need to have Node.js installed.

Get started

Install the dependencies...

cd svelte-spa-app
npm install

...then start Rollup:

npm run dev

Navigate to localhost:5000. You should see your app running. Edit a component file in src, save it, and reload the page to see your changes.

By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv commands in package.json to include the option --host 0.0.0.0.

If you're using Visual Studio Code we recommend installing the official extension Svelte for VS Code. If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.

Building and running in production mode

To create an optimised version of the app:

npm run build

You can run the newly built app with npm run start. This uses sirv, which is included in your package.json's devDependencies so that the app will work when you deploy to platforms like Heroku.

Using TypeScript

This template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with:

node scripts/setupTypeScript.js

Or remove the script via:

rm scripts/setupTypeScript.js

If you want to use baseUrl or path aliases within your tsconfig, you need to set up @rollup/plugin-alias to tell Rollup to resolve the aliases. For more info, see this StackOverflow question.

Deploying to the web

With Vercel

Install vercel if you haven't already:

npm install -g vercel

Then, from within your project folder:

cd public
vercel deploy --name my-project

With surge

Install surge if you haven't already:

npm install -g surge

Then, from within your project folder:

npm run build
surge public my-project.surge.sh

With GitHub Pages

Make sure you have a github account and you've logged into the account.

Then make a New github repo and name it as follows - username.github.io where username is your github username you're using and make sure your repo is public.

Finally, Upload your build files and after a minute goto username.github.io where username is your github username.


Thanks

You might also like...

Time-traveling debugger for Svelte applications

Time-traveling debugger for Svelte applications

DeLorean The first time-travelling debugger for Svelte applciations DeLorean is a debugging tool for Svelte developers. It records snapshots when a ta

Oct 8, 2022

Add Routify to your Svelte project

🎀 Add (work in progress) Routify to Svelte This is an adder for svelte-add; you should read its README before continuing here. ➕ Adding (work in prog

Aug 3, 2022

Small library to accomplish common tasks in Svelte/SvelteKit

svelte-utilities svelte-utilities is a small utilities library for Svelte/SvelteKit that provides features I use in almost every project, such as: Laz

Nov 25, 2022

Vite Svelte plugin to remove console logs in prod.

vite-plugin-svelte-console-remover A Vite plugin that removes all console statements (log, group, dir, error, etc) from Svelte, JS, and TS files durin

Oct 13, 2022

Write CSS modules without leaving your javascript!

vite-plugin-inline-css-modules Write CSS modules without leaving your javascript! Zero Runtime Contains full feature set of CSS modules (Includes Post

Jan 2, 2023

🌈 CLI tool to scaffold chakra ui projects, without wasting time.

🌈 CLI tool to scaffold chakra ui projects, without wasting time.

Create Chakra Project (create-chakra) âš’ Tool to scaffold chakra apps, without wasting time. It uses existing tools like create-next-app and create-vit

Nov 29, 2022

Light speed setup for MEVN(Mongo Express Vue Node) Apps

Light speed setup for MEVN(Mongo Express Vue Node)  Apps

Light speed setup for MEVN stack based web-apps Chat: Telegram Donate: PayPal, Open Collective, Patreon A CLI tool for getting started with the MEVN s

Dec 14, 2022

Integrate Tauri in a Vite project to build cross-platform apps.

vite-plugin-tauri Integrate Tauri in a Vite project to build cross-platform apps Install Make sure to setup your environment for Tauri development. Th

Dec 15, 2022

Adapter for SvelteKit apps that prerenders your site as a collection of static files for GitHub Pages

svelte-adapter-github Adapter for SvelteKit apps that prerenders your site as a collection of static files for GitHub Pages. Usage Install with npm i

Sep 20, 2022
Owner
ADITYA
I Command Computers to do stuff for me.
ADITYA
A template repository / quick start to build Azure Static Web Apps with a Node.js function. It uses Vue.js v3, Vue Router, Vuex, and Vite.js.

Azure Static Web App Template with Node.js API This is a template repository for creating Azure Static Web Apps that comes pre-configured with: Vue.js

Marc Duiker 6 Jun 25, 2022
Admin UI Template is a modern, responsive, and customizable admin UI template for your business.

Admin UI Template is a modern, responsive, and customizable admin UI template for your business. It contains reusable components, theme color, and design support along with dark theme support.

Open Template Hub 7 Dec 18, 2022
@auth0/auth0-spa-js wrapper in the "Vue way", with full TS support

vue-auth0 This is a wrapper around @auth0/auth0-spa-js meant to ease the usage into Vue projects. This is heavily inspired by the snippet into Auth0 o

Dreamonkey S.r.l. 5 Oct 18, 2022
Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.

Onsen UI - Cross-Platform Hybrid App and PWA Framework Onsen UI is an open source framework that makes it easy to create native-feeling Progressive We

null 8.7k Jan 4, 2023
Vue Native is a framework to build cross platform native mobile apps using JavaScript

Vue Native Visit our website at vue-native.io or read the official documentation here. Build native mobile apps using Vue Vue Native is a framework to

GeekyAnts 8.4k Jan 6, 2023
📓 The UI component explorer. Develop, document, & test React, Vue, Angular, Web Components, Ember, Svelte & more!

Build bulletproof UI components faster Storybook is a development environment for UI components. It allows you to browse a component library, view the

Storybook 75.9k Jan 9, 2023
NativeScript empowers you to access native api's from JavaScript directly. Angular, Vue, Svelte, React and you name it compatible.

NativeScript empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile de

NativeScript 22k Jan 4, 2023
Matteo Bruni 4.7k Jan 4, 2023
bare bones demo of svelte-three

create-svelte Everything you need to build a Svelte project, powered by create-svelte; Creating a project If you're seeing this, you've probably alrea

Rich Harris 39 Jul 30, 2022
A svelte action for creating tippy.js tooltips with full typescript support

Tippy.js for svelte A svelte action for creating tippy.js tooltips. Getting started # Pnpm pnpm add svelte-tippy tippy.js # Yarn yarn add svelte-tipp

Brett Mandler 11 Jul 19, 2022