Component API
Server
Unlike client-side components, server-side components don't have a lifespan after you render them — their whole job is to create some HTML and CSS. For that reason, the API is somewhat different.
A server-side component exposes a render
method that can be called with optional props. It returns an object with head
, html
, and css
properties, where head
contains the contents of any <svelte:head>
elements encountered.
You can import a Svelte component directly into Node using svelte/register
.
The .render()
method accepts the following parameters:
The options
object takes in the following options: