svelte-rails Svelte Themes

Svelte Rails

This is an experimental app template that allows a view to be composed of any combination of Svelte components and .html.erb

Svelte + Rails

This is a template of an app with a setup that allows Svelte components to be used in combination with ERB templates to render views.

This also includes:

Dev

You will find Svelte components in app/frontend/svelte/. To add them to a Rails view (.html.erb file), see details in app/frontend/svelte/index.ts.

Example:

See app/views/home/index.html.erb:

<svelte-home data-props="<%= @data.to_json %>"></svelte-home>

Setup

bundle install
yarn

Run app:

bundle exec rails s
bin/vite dev

Top categories

Loading Svelte Themes