Quick setup Svelte 3 SPA: svelte3-app

9zemian5

Oleksandr Demian

Posted on March 28, 2020

Quick setup Svelte 3 SPA: svelte3-app

Introduction

svelte3-app is an npx command for quick setup of your svelte 3 project.

You don't have to install it locally, but be sure you have at least npm@5.2.0 version installed.

Basic usage

npx svelte3-app
Enter fullscreen mode Exit fullscreen mode

The command above will create a svelte project based on the official template configured with Rollup in the folder you run it within.

It offers some customization for your project. For example, you can decide whenever to use Rollup or Webpack as your bundler or to create a project using Sapper.

Inputs

  • -n -> the name of the project (if empty, the project will be created in the directory it called within, ex: npx svelte3-app -n client)
  • -s -> initialize the project with sapper framework (ex: npx svelte3-app -s, value is not required, but you can pass true right after)
  • -b -> bundler to use (rollup is default, ex: npx svelte3-app -b webpack)

Examples

1) Create a svelte 3 project under svelte-rollup folder configured with rollup:

npx svelte3-app -n svelte-rollup
Enter fullscreen mode Exit fullscreen mode

2) Create a svelte 3 project under svelte-webpack folder configured with webpack:

npx svelte3-app -n svelte-webpack -b webpack
Enter fullscreen mode Exit fullscreen mode

3) Create a svelte 3 project under sapper-rollup folder configured with rollup and sapper:

npx svelte3-app -n sapper-rollup -s
Enter fullscreen mode Exit fullscreen mode

4) Create a svelte 3 project under sapper-webpack folder configured with webpack and sapper:

npx svelte3-app -n sapper-webpack -b webpack -s
Enter fullscreen mode Exit fullscreen mode
šŸ’– šŸ’Ŗ šŸ™… šŸš©
9zemian5
Oleksandr Demian

Posted on March 28, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related