Installation

bundle add svelte-on-rails
rails g svelte_on_rails:install

The installer is designed to be carefully and safe:

  • First, it checks whether vite_rails is installed.
  • Then it runs npm dependency checks in an isolated sandbox at
    tmp/svelte-on-rails-installer-sandbox-tests within the app:
    • It first tries to install the latest versions of the necessary packages.
    • If that fails, it tries to update vite and run the dependency checks again.
    • If that fails, it uses a hardcoded set of fixed versions.
  • After all checks pass, it asks for confirmation before applying changes to your app.
  • It does not overwrite existing files without asking, except option --force is passed.

Just follow the prompts.

The installer is designed to handle all, up from a virgin rails app, up from rails-6, together with the vite_rails gem.

For all normal cases, just add the gem and run the installer like described.

Installer options

The installer can be used with the options:

  • --force
  • --package-set
    • Force the installer to use a specific package-set (fallback automatism is skipped)
    • This is mainly written for internal testing purposes.
    • Available keys you can find on the :key attribute, within the candidate_sets on the repo