Quick Start

Creating a project

Run one of the following command
Depend on what package manager you are using

npm create @sveltepress
npm create @sveltepress
sh
PNPM first

Use pnpm as much as possible. It respects package version more than npm.

Adding to an existing sveltekit project

Install vite plugin package

npm install --save @sveltepress/vite
npm install --save @sveltepress/vite
sh

Replace sveltekit plugin in vite.config.(js|ts)

vite.config.(js|ts)
-
+
-
+
import { defineConfig } from 'vite'

import { sveltekit } from '@sveltejs/kit' 

import { sveltepress } from '@sveltepress/vite' 

const config = defineConfig({
  plugins: [
    sveltekit(), 
    sveltepress(), 
  ],
})

export default config
import { defineConfig } from 'vite'

import { sveltekit } from '@sveltejs/kit' 

import { sveltepress } from '@sveltepress/vite' 

const config = defineConfig({
  plugins: [
    sveltekit(), 
    sveltepress(), 
  ],
})

export default config
js

Add '.md' extension to the extensions options in your svelte.config.js

svelte.config.js
-
+
import adapter from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/kit/vite'

/**
 * @type {import('@sveltejs/kit').Config}
 */
const config = {
  extensions: ['.svelte'], 
  extensions: ['.svelte', '.md'], // add .md here 
  preprocess: [vitePreprocess()],
  kit: {
    adapter: adapter({
      pages: 'dist',
    }),
  },
}

export default config
import adapter from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/kit/vite'

/**
 * @type {import('@sveltejs/kit').Config}
 */
const config = {
  extensions: ['.svelte'], 
  extensions: ['.svelte', '.md'], // add .md here 
  preprocess: [vitePreprocess()],
  kit: {
    adapter: adapter({
      pages: 'dist',
    }),
  },
}

export default config
js
Last update at: 2023/08/10 20:32:21