Prerequisite: Before installing or start working on Svelte, we have to make sure few things are available in our sustem.
- Any Text Editor(e.g vs code, Atom etc.)
- NodeJS installed in your system:
Installation of Svelte: Now we are ready to install the Svelte.
- Step 1: Open the command prompt or terminal and install a package named degit, which allows us to easily clone the latest commit from a github repository.
npm install -g degit
- Step 2: Now create a directory on the desktop and run the below command. The degit go to the repository(sveltejs) find the template and download it locally for us in the project named myproject.
degit sveltejs/template myproject
- Step 3: The project is created, now open this in text editor. In the src folder we have main.js file which is used to execute our svelte app The App.svelte is the root component of our application and the package.json file contains all the dependencies which needs to be installed.
- Step 4: Now install all the dependencies make sure you are inside of the “myproject” directory.
- Step 5: Now create a local development server to run our application.
npm run dev
- Step 6: Now follow the above link and application will open in the browser.