With few commands Sveltin flex the muscles 💪
Using 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:
Install all the dependencies:
Open the config/website.js.ts file and edit the info.
Let's see if everything is ok. Run the server:
Let move on! Create a public page as Svelte component to be served at /contact
sveltin new page contact --as svelte
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 posts/welcome
One more, please:
sveltin add content posts/getting-started --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:
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.