Skip to content

Variants

File variants are a feature in Rails that we use to denote on a file basis which components should be server or client rendered. It has precedence over the Svelte.ssr global but not the ssr local.

To set the variant, append either +client or +server after .html in the filename, like index.html+client.svelte

Examples

Filenames

  app/views/example/show.html+client.svelte
  app/views/example/show.html+server.svelte

Controller

ruby
render "view", variant: "client"