Svelte is a frontend framework which is used to build fast applications. But it is used for creating a single page app without navigation. In this article we will learn quickly how to install and create a project in Svelte.

Installing Node

First of all you need latest version of node. For all javascript frameworks like React, Vuejs, Svelte etc., we need nodejs. If you already have one then jump to next section otherwise use this link to download – https://nodejs.org/en/download/

Installing Svelte

After downloading Nodejs, we are ready for Svelte. Open command prompt and move to the directory where you want to create the project. Then use this command –

npx degit sveltejs/template my-project-name
installing svelte using degit

Change my-project-name with the name of your project.

Let the process complete and then move to the project folder using this command –

cd my-project-name
change directory

Again change my-project-name with your project name.

It’s time to install all the dependencies listed in package.json file. Use the below command –

npm install
npm install

This will take a while. After it gets completed, you will have a well setup project.

In order to run it, use this command –

npm run dev
npm run dev

It will provide you a localhost url with port. The default url for Svelte is – http://localhost:5000

Running website on localhost 5000

Now you can move on with the development.

When you are ready to publish your web app, you can make the production build with this command –

npm run build

Β Β Β Β Tweet this to help others

Next Article

Directories and Files Structure of Svelte Projects

Tagged in:

Comments

About the Author

akamit

I am Akash Mittal, an overall computer scientist. If you want to guest post, need help in your projects, want to advertise, Feel free to contact me at [email protected]

View All Articles