Svelte Static Site Generation

Svelte is a great platform to create any type of site. If you want to create a site and host it on Github Pages, you can use Svelte to generate a static site and upload the files to the desired GitHub repository. Here's how!

Adapter

Install the static adapter with the command below:

1npm i -D @sveltejs/adapter-static

Configuration

Replace your svetle.config.js file with the contents below:

 1import adapter from "@sveltejs/adapter-static";
 2
 3export default {
 4  kit: {
 5    adapter: adapter({
 6      // default options are shown. On some platforms
 7      // these options are set automatically — see below
 8      pages: "build",
 9      assets: "build",
10      fallback: null,
11      precompress: false,
12      strict: true,
13    }),
14  },
15};