With few commands Sveltin flex the muscles 💪

Sveltin is preatty easy. Here you will learn how to get started with Sveltin creating a sample project. What you will get is a production ready website. Ok, no more words. Let’s get started!

Create a project:

$ sveltin init myBlog

The CLI will ask you to select the package manager/npmClient (npm, yarn or pnpm) you want to use based on what is installed on your system.

Then, you select the CSS lib for your project. It can be vanilla CSS, Sass / SCSS, Tailwind CSS, Bulma or Bootstrap. You can use the shortcut –css flag. Check the new command documentation.

Move to the project folder:

$ cd myBlog

Install all the dependencies:

$ sveltin install

Open the config/website.js.ts file and edit the info.

Let’s see if everything is ok. Run the server:

$ sveltin server

Let move on! Create the contact page and use Svelte for the content:

$ sveltin new page contact --svelte

Create the _about_page and use Markdown (mdsvex) to write the content:

$ sveltin new page about --markdown

So far so good! Nothing special there, let flex the muscle again!

No blog without posts so, start creating a posts resource:

sveltin new resource posts

Add new post to the posts resource to be served at /posts/welcome

$ sveltin add content welcome --to posts

One more, please:

$ sveltin add content getting-started --to posts --sample

A common use case is to have the content grouped by metadata, e.g. category. Add a ‘category’ metadata to have a list of grouped content at /posts/category

$ sveltin add metadata category --to posts --as single

Let’s generate the sitemap and the RSS feed files. Open the env.production file and edit VITE_PUBLIC_BASE_PATH to reflect your domain name. Now, run the following sveltin’s commands:

$ sveltin generate sitemap

$ sveltin generate rss

Sveltin will generate sitemap.xml and rss.xml files within the static folder so that they will be copied as they are during the build process.

Run the server:

$ sveltin server

Alright! Your project is up and running. Please, refer to the cli docs to learn more on adding more metadata types, generate the sitemap, rss, the menu structure etc.

Last updated: 06-Feb-2023

Apache 2.0 License @ 2021-present Sveltin.io and contributors .

The Sveltin logos are copyright © Mirco Veltri.