Typescript template for Svelte v3


svelte app

This is a project template for Svelte apps. It lives at https://github.com/pyoner/svelte-typescript

Install

For Linux users

mkdir svelte-app
curl -L https://github.com/pyoner/svelte-typescript/tarball/master > svelte-typescript.tar
tar --strip-components=3 --wildcards --one-top-level=svelte-app -xf svelte-typescript.tar '*/packages/template'

For Mac users

mkdir svelte-app
curl -L https://github.com/pyoner/svelte-typescript/tarball/master > svelte-typescript.tar
tar --strip-components=3 -C svelte-app -xf svelte-typescript.tar '*/packages/template/' 

For Windows users

Download https://github.com/pyoner/svelte-typescript/archive/master.zip and extract template from packages/template

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

For VSCode users

Regardless of your OS, if you're using VSCode as your IDE for your Svelte project, you also need to do an extra step in order to have full language support with svelte-code extension.

Create a svelte.config.js file in the root of your project with the following content:

const { preprocess } = require("@pyoner/svelte-ts-preprocess")

module.exports = {
  preprocess: preprocess()
}

Get started

Install the dependencies...

cd svelte-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.

Deploying to the web

With now

Install now if you haven't already:

npm install -g now

Then, from within your project folder:

now

As an alternative, use the Now desktop client and simply drag the unzipped project folder to the taskbar icon.

With surge

Install surge if you haven't already:

npm install -g surge

Then, from within your project folder:

npm run build
surge public

svelte-typescript