Skip to content

Feature: render HTML without hydrationΒ #14337

@trueadm

Description

@trueadm

It can be beneficial to render HTML from Svelte without the need to handle hydration – for things such as email content, CMSs, RSS feeds and other such cases.

Rather than being an option we pass in to render from svelte/server, we should likely use another API here to enable future compatibility with possible async functionality, thus making this an API you should await (similar to what React does for this) as without hydration, showing async loading content would be useless. This change would meant that await blocks would no longer show their pending states and instead wait until the promise resolves.

import { renderStaticHTML } from 'svelte/server';
import App from './App.svelte';

const result = await renderStaticHTML(App, {
	props: { some: 'property' }
});
result.body; // HTML for somewhere in this <body> tag
result.head; // HTML for somewhere in this <head> tag

For this I propose renderStaticHTML but maybe there's a better name out there.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions