Naming

Svelte strongly recommends naming components in CamelCase.

The SvelteOnRails view helper requires:

  • MyComponent

which looks for:

  • MyComponent.svelte

Option: app/views

If you are using the option to have Svelte components within app/views, then, within app/views, you must use one of the following:

  • my_component
  • MyComponent

which looks for:

  • _my_component.svelte
  • _MyComponent.svelte

This is because you can think of the view helper as rendering a partial, as you would in Rails.


Copyright © 2025-2027 sedlmair.ch. Distributed by MIT license.