Description of oposum Skip to main content
djs404.me

post7-setting up a github.io static-site WIP.

what is svelte #

Svelte is a new way to build web applications. It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.

Imagine building web apps that are blazing fast, super small, and a breeze to code. That's SvelteKit! Compared to React, it compiles code down to tiny vanilla JavaScript, ditching the virtual DOM for smooth performance. Plus, you write less code overall, thanks to its familiar HTML, CSS, and JavaScript approach. Ideal for small projects or when speed is king.

how i set up a github.io static-site using sveltejs WIP. #

Here's a breakdown of setting up a GitHub Pages static site using SvelteKit:

1. Create a SvelteKit project:

Use the npx command to initialize a new SvelteKit project:

npx degit @sveltejs/kit my-sveltekit-app
cd my-sveltekit-app
```a

Replace `my-sveltekit-app` with your desired project name.

**2. Configure for GitHub Pages (optional):**

- If your website will be deployed at the root of your GitHub Pages URL (e.g., `https://username.github.io`), no configuration is needed.
- If your website will be deployed in a subfolder (e.g., `https://username.github.io/your-project-name`), you'll need to adjust the base path in `svelte.config.js`:

```javascript
import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  kit: {
    adapter: adapter(),
    // Add this line with your subfolder path
    paths: { base: '/your-project-name' },
  },
};

export default config;

3. Develop your website:

4. Build for deployment:

pnpm build

5. Create a .nojekyll file (optional):

6. Deploy to GitHub Pages:

There are two main approaches:

Here are some helpful resources for further guidance:

SvelteKit deployment guide: https://kit.svelte.dev/docs/building-your-app How to deploy a SvelteKit website to GitHub Pages: https://medium.com/mkdir-awesome/two-easy-ways-to-publish-your-svelte-project-on-github-pages-c8eaca2b6225

my repos

this repo