https://github.com/dashpilot/svelte-5-ssr
Example of how to server-side render a Svelte 5 component
https://github.com/dashpilot/svelte-5-ssr
Last synced: 7 months ago
JSON representation
Example of how to server-side render a Svelte 5 component
- Host: GitHub
- URL: https://github.com/dashpilot/svelte-5-ssr
- Owner: dashpilot
- Created: 2024-12-24T01:38:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-25T11:38:49.000Z (over 1 year ago)
- Last Synced: 2025-01-01T00:37:18.145Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://svelte-5-ssr.vercel.app
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Svelte 5 Server-side rendering (SSR)
Simple example of how you can server-side-render a Svelte 5 component.
## How it works:
1. In order to SSR a Svelte component, you first need to compile it into a .js file, so Node.js can work with it
2. After that, you import the precompiled file, and render it
## Features
- precompiles all files files in a certain directory and its subfolders
- supports nested components
- supports runes
- supports style tags inside components, and inlines them into the head
- no need for Vite or Rollup: all compilation happens server-side
## How to run
Install dependencies:
```bash
npm install
```
Run the script:
```bash
npm run build
```
## Press the :star: button
Don't forget to press the :star: button to let me know I should continue improving this project.