Showcase

The gem has a generator for a full-feature example. It demonstrates the features, and is used for testing and developing the gem itself.

rails g svelte_on_rails:showcase

What it adds:

  • Packages/gems:
    • @hotwired/turbo-rails and turbo-rails (runs rails turbo:install): shows how components work with Turbo, especially initial vs. subsequent page loads
    • axios, for the example HTTP interactions
    • @rails/actioncable
  • Routes, like get "svelte_on_rails_showcase/index"
  • Files:
    • app/controllers/svelte_on_rails_showcase_controller.rb and views in app/views/svelte_on_rails_showcase/
    • Components in app/frontend/javascript/svelte_on_rails_showcase/
    • ActionCable: app/channels/application_cable/channel.rb, app/channels/application_cable/connection.rb, app/channels/svelte_on_rails_channel.rb and app/frontend/initializers/actionCable.js

Restart your server and open localhost:3000/svelte_on_rails_showcase.