diff --git a/docs/src/guide/deployment.md b/docs/src/guide/deployment.md index bc3abb42..731739e3 100644 --- a/docs/src/guide/deployment.md +++ b/docs/src/guide/deployment.md @@ -126,20 +126,27 @@ If using [vite-plugin-rails], assets will be compressed using gzip an While it was originally designed for sprockets, you can easily configure it for _Vite Ruby_, which means you get automatic removal of expired assets, and manifest backups. +It's necessary to extend [the default configuration](https://github.com/capistrano/rails/blob/d86a8db16281f09d8cfff9ee791297134bce9801/lib/capistrano/tasks/assets.rake#L139) +so that it detects the following files: + +- `manifest.json`: generated [by Vite](https://vitejs.dev/config/build-options.html#build-manifest) for entrypoints +- `manifest-assets.json`: generated [by `vite-plugin-ruby`](https://github.com/ElMassimo/vite_ruby/blob/main/vite-plugin-ruby/src/manifest.ts#L26-L29) for other assets + ```ruby # config/deploy.rb -# Must match `ViteRuby.config.public_output_dir`, which by default is 'vite' -set :assets_prefix, 'vite' -``` - -The [default value](https://github.com/capistrano/rails/blob/d86a8db16281f09d8cfff9ee791297134bce9801/lib/capistrano/tasks/assets.rake#L139) for `:assets_manifests` should already backup both: -- `manifest.json`: generated by Vite for entrypoints -- `manifest-assets.json`: generated by _Vite Ruby_ +append :linked_dirs, "public/vite" +append :assets_manifests, "public/vite/.vite/manifest*.*" + ``` See [capistrano-rails] for more information about relevant settings such as `keep_assets` and `assets_roles`. +:::warning Custom Output Dirs +When customizing `ViteRuby.config.public_output_dir` or `ViteRuby.config.public_dir` +change `"public/vite"` to reflect your configuration. +::: + ## Using Heroku In order to deploy to Heroku, it's necessary to add the [nodejs][nodejs buildpack] and [ruby][ruby buildpack] buildpacks.