Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joekrump/svelte-rails
This is an experimental app template that allows a view to be composed of any combination of Svelte components and .html.erb
https://github.com/joekrump/svelte-rails
ruby ruby-on-rails svelte tailwind tailwindcss vite
Last synced: about 2 hours ago
JSON representation
This is an experimental app template that allows a view to be composed of any combination of Svelte components and .html.erb
- Host: GitHub
- URL: https://github.com/joekrump/svelte-rails
- Owner: joekrump
- Created: 2021-10-28T02:02:19.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-08T18:54:03.000Z (over 1 year ago)
- Last Synced: 2024-12-22T03:23:48.835Z (15 days ago)
- Topics: ruby, ruby-on-rails, svelte, tailwind, tailwindcss, vite
- Language: Ruby
- Homepage:
- Size: 2.47 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
- Hot module replacement for `.svelte` files
- Hot reloading for changes to `routes.rb` and Rails view files. See [`vite.config.ts`](https://github.com/joekrump/svelte-rails/blob/b62219c0e71d614b8d5f7c398e47e3efb47244e6/vite.config.ts) for details.
- A Rails helper to allow for easy addition of `.svelte` components into `.html.erb` templates using `` syntax. See [`app/frontend/svelte/index.ts`](https://github.com/joekrump/svelte-rails/blob/c08b917c80eacffe38b668bdb156160ffe7718a6/app/frontend/svelte/index.ts) for details.
- [TailwindCSS for styling](https://tailwindcss.com)## 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`](https://github.com/joekrump/svelte-rails/blob/c08b917c80eacffe38b668bdb156160ffe7718a6/app/frontend/svelte/index.ts).
Example:
See `app/views/home/index.html.erb`:
```erb
```
### Setup```bash
bundle install
yarn
```### Run app:
```bash
bundle exec rails s
bin/vite dev
```