svelte-on-rails 7.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -65
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9417b9aeb24ed03a4514768dfb287e15a87da1f140b54cb23bd385f00700595a
4
- data.tar.gz: 98153133cdb29712e373cd55b954075710d15c4bc207617debcde53cf66a4357
3
+ metadata.gz: 6b61dc717ae11cdc216f2ce8a35239826d075e7fdb04559ac36f124d912ec593
4
+ data.tar.gz: 9abd85b4352eda996544904ce4df984773ebedbdf580a1c8d4aec59ab31c1481
5
5
  SHA512:
6
- metadata.gz: 72255646b45908c55a8f4ce8a153df8ff106bff9541a371b7ce9249cbeff770288ed34ad7668ba3e0f479c03b029d61a84358c5ab55e36140bd6308864be1998
7
- data.tar.gz: 6473071bd3628ce361d1b8796df21ae7ce206ec10de8ae6d4cd36a40778da2b8dab7f8b194b0fa86383907b0c68c14b200fbd969358dc10e9748b833a90b9c80
6
+ metadata.gz: 44935ca3cca431137508364778578b588fb0bf3339315823b975c98995640c46e8fd67fe05bc92a5cea7233a1ea1be2bcd540bc1a0955513e667f3bda283fe38
7
+ data.tar.gz: a778b7fbc71ad035c93e08cf99ba559c67fc18c8bd6cb717583e35a092c57cef8bc8a99c97ce26ba0fc98fdbe53d907d5ef67a45a8bff5458f48ca963c18c96d
data/README.md CHANGED
@@ -51,19 +51,27 @@ see [issues](https://gitlab.com/sedl/svelte-on-rails/-/issues)
51
51
  Renders Svelte components server-side and, together with [@csedl/svelte-on-rails](https://www.npmjs.com/package/@csedl/svelte-on-rails),
52
52
  hydrates the component on the frontend.
53
53
 
54
- This way svelte works perfectly together with turbo. You will never notice
55
- this unpleasant «blink» on the frontend while the whole process is maximum
56
- performance optimized.
57
-
58
- **STATUS:** This gem is in the early stages of development, but is ready for use.
59
- It has nearly 100% test coverage, with all tests passing. It has been in use since May/June 2025
60
- on the systems of my two biggest customers.
54
+ Together with `turbo-rails` or `turbolinks`, if configured, it renders server-side only on initial requests
55
+ and delivers a empty tag that will be rendered by frontend.
61
56
 
62
57
  If you have issues, please open one, and contributors are welcome!
63
58
 
64
59
  ## Requirements
65
60
 
66
- [Requirements](https://svelte-on-rails-docs-51acfa.gitlab.io/requirements.html)
61
+ - tested on
62
+ - ruby 3.2.2 and rails 7.1
63
+ - ruby 2.7.5 and rails 6.1
64
+ - vite@6 (v7 not supported, see issues)
65
+ - turbolinks and hotwired/turbo
66
+ - vite_rails (the installer will install it by option --full or --vite)
67
+ - svelte@5, @sveltejs/vite-plugin-svelte@5 (see: [how to install svelte on rails/vite](https://dev.to/chmich/setup-inertia-and-svelte-on-rails-7-3glk))
68
+ - turbo (recommended / [how to install turbo on rails](https://github.com/hotwired/turbo-rails?tab=readme-ov-file#installation))
69
+ - npm on latest versions
70
+ - actual node installed.
71
+ - if `nvm` is installed it gets the path to the node-binary from there.
72
+ - When `.nvmrc` is present on projects root, it is respected
73
+ - If node is not included on the PATH you can configure your node path by environment variable `SVELTE_ON_RAILS_NODE_BIN`
74
+
67
75
 
68
76
  ## Installation
69
77
 
@@ -99,65 +107,8 @@ Add it to the view
99
107
  <%= svelte_component('HelloWorld', {title: 'Hello World'}) %>
100
108
  ```
101
109
 
102
-
103
110
  And you should see "Svelte Hello World" on the browser! 👍 🤗
104
111
 
105
- **Explanation**
106
-
107
- this Minimal installer does:
108
-
109
- - add `app/frontend/initializers/svelte.js`
110
- - Adds a import statement for that initializer to `application.js`
111
- - add `app/frontend/ssr/ssr.js`
112
- - add `config/svelte_on_rails.yml`
113
- - add `vite-ssr.config.ts`
114
- - add command `npm run build:ssr` to package.json
115
- - installs or updates npm packages to the latest:
116
- - `@csedl/svelte-on-rails`
117
- - `typescript`
118
- - `@types/node`
119
-
120
-
121
- ## Process explanation
122
-
123
- **Why not client and server rendering in one process?**
124
-
125
- That was my idea! `application.js` which is the usual entry point for the client
126
- side could live on the same assets and manifest like svelte components that are
127
- compiled as chunks which each is its own entry point. This failed:
128
-
129
- - The `vite-plugin-ruby` did not support this: it constrained all to one entry point.
130
- - See how fat the `vite-ssr.config.ts` is. For the client side this is not necessary.
131
-
132
- At the end, I decided to split the process. For now it is cleaner. But that is not the last decision.
133
-
134
- **Why not compiling server side purely by rollup?**
135
-
136
- Advantages would be much slimmer packages and faster compilation. On the first
137
- step i did this and i backed up a working and tested code on the branch [rollup-ssr](https://gitlab.com/sedl/svelte-on-rails/-/blob/rollup-ssr/BRANCH_INFO.md?ref_type=heads).
138
-
139
- I decided to use Vite to bring the client and server side rendering
140
- closer together.
141
-
142
- But this, too, is not the last decision.
143
-
144
- For now we proceed with vite.
145
-
146
- **How does it work now?**
147
-
148
- Client side rendering is done by vite like usual.
149
-
150
- Server side rendering is triggered, similar to [vite_rails](https://vite-ruby.netlify.app/guide/deployment.html)
151
- on `assets:precompile`, and, if `watch_changes` is configured,
152
- which is default for development, it is triggered
153
- on every change of a `*.svelte` file within the configured `components_folder`.
154
-
155
- On the server side only the `*.svelte` files are served. Theyr included
156
- assets are linked to the client side assets folder, which is mapped by `manifest.json`.
157
-
158
- Then, vite has two output folders: `vite-dev` for development and `vite` for production.
159
- Within `vite-ssr.config.ts`, by the `RAILS_ENV` variable, is decided which one is used.
160
-
161
112
 
162
113
  ## Licence
163
114
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svelte-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair
@@ -78,13 +78,13 @@ files:
78
78
  - templates/config_base/app/frontend/ssr/ssr.js
79
79
  - templates/config_base/config/svelte_on_rails.yml
80
80
  - templates/config_base/vite-ssr.config.ts
81
- homepage: https://gitlab.com/sedl/svelte-on-rails
81
+ homepage: https://svelte-on-rails-docs-51acfa.gitlab.io/
82
82
  licenses:
83
83
  - MIT
84
84
  metadata:
85
- homepage_uri: https://gitlab.com/sedl/svelte-on-rails
86
- source_code_uri: https://gitlab.com/sedl/svelte-on-rails
87
- changelog_uri: https://gitlab.com/sedl/svelte-on-rails
85
+ homepage_uri: https://svelte-on-rails-docs-51acfa.gitlab.io/
86
+ source_code_uri: https://svelte-on-rails-docs-51acfa.gitlab.io/
87
+ changelog_uri: https://svelte-on-rails-docs-51acfa.gitlab.io/
88
88
  post_install: ruby -r svelte_on_rails/install -e 'SvelteOnRails::Install.run'
89
89
  rdoc_options: []
90
90
  require_paths: