Minimal SvelteKit set-up made deployable to GitHub Pages.
SvelteKit-gh-pages is a minimal static SvelteKit setup that is designed to be deployable to GitHub Pages. It provides a streamlined process for deploying SvelteKit apps on GitHub Pages without the need for complex configuration.
To install the SvelteKit-gh-pages theme, follow these steps:
npm install --save-dev @sveltejs/adapter-static
svelte.config.js
file at the top-level of your project to include the following code:export default {
kit: {
adapter: adapter(), // Import and initialize the static adapter
prerender: true, // Enable prerendering for improved performance
},
};
Modify the paths.base
configuration in the svelte.config.js
file to match the subpath of your GitHub Pages repository. For example, if your repository is named sveltekit-gh-pages
, the paths.base
should be set to /sveltekit-gh-pages
.
Add an empty .nojekyll
file to the static
folder in your project. This will bypass Jekyll on GitHub Pages.
Update the deploy
script in your package.json
file to include the following configuration:
{
"scripts": {
"deploy": "gh-pages -d build -t true"
}
}
SvelteKit-gh-pages is a convenient solution for deploying SvelteKit apps on GitHub Pages. By integrating the static adapter, modifying the configuration, and bypassing Jekyll, developers can easily deploy their apps on GitHub Pages without any hassle.