Repo of an article I wrote about SvelteKit and on demand caching with Service Workers
Create-Svelte is a tool that provides everything you need to build a Svelte project. It is powered by create-svelte and offers a streamlined process for developing and building Svelte applications.
To get started with Create-Svelte, follow these steps:
Make sure you have Node.js installed on your machine.
Open a terminal and run the following command to install Create-Svelte globally:
npm install -g create-svelte
Once the installation is complete, you can create a new Svelte project by running the following command in your terminal:
create-svelte my-app
Replace my-app with the desired name of your project.
After the project is created, navigate into the project folder:
cd my-app
Install the project dependencies using either npm, pnpm, or yarn. For example, with npm:
npm install
Start the development server:
npm run dev
This will launch a local development server where you can preview your Svelte application.
When you’re ready to build a production version of your app, install an adapter for your target environment using the following command:
npm install --save-dev @sveltejs/adapter-*@next
Replace @sveltejs/adapter-* with the appropriate adapter for your target environment (e.g., @sveltejs/adapter-static for a static site generator).
Build the production version of your app:
npm run build
This will generate optimized and minified files ready for deployment.
To preview the built app, you can use the following command:
npm run preview
Note that this command is intended for previewing purposes only and should not be used to serve your app in production.
Create-Svelte is a powerful tool that simplifies the process of building Svelte applications. It provides an easy project creation process, dependency management, a development server for previewing and testing, and options for building a production-ready version of your app. By following the installation guide, you can quickly set up a Svelte project and start developing with ease.