Skip to content

Commit

Permalink
docs: add environment variables section (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo authored Jun 7, 2024
1 parent cc46e3a commit 943969d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
40 changes: 31 additions & 9 deletions docs/src/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
[ssrOutputDir]: /config/#ssroutputdir
[ssr mode]: https://vitejs.dev/guide/ssr.html#server-side-rendering
[inertia-ssr]: https://github.com/ElMassimo/inertia-rails-ssr-template
[deployment]: /guide/deployment.html#deployment-🚀

# Configuring Vite Ruby

Expand Down Expand Up @@ -268,15 +269,6 @@ You can customize this behavior using the following options.
"base": "/nested_path"
```
### configPath
- **Default:** `config/vite.json`
- **Env Var:** `VITE_RUBY_CONFIG_PATH`
Specify where the [JSON config] file is located (relative to <kbd>[root]</kbd>).
Not supported in the JSON file.
### devServerConnectTimeout
- **Default:** `0.01` (seconds)
Expand Down Expand Up @@ -362,6 +354,36 @@ You can customize this behavior using the following options.
},
})
```
## ENV-Only Options

### `config_path`

- **Default:** `config/vite.json`
- **Env Var:** `VITE_RUBY_CONFIG_PATH`

Specify where the [JSON config] file is located (relative to <kbd>[root]</kbd>).

### `skip_install_dev_dependencies`

- **Version Added:** `3.3.3`
- **Default:** `false`
- **Env Var:** `VITE_RUBY_SKIP_INSTALL_DEV_DEPENDENCIES`

When enabled, the `vite:install_dependencies` rake task will also install
development dependencies, which is usually necessary in order to run a Vite build.

By adding Vite and its plugins (plus other tools such as ESLint) as development
dependencies, you can easily prune them after assets have been precompiled.

### `skip_assets_precompile_extension`

- **Default:** `false`
- **Env Var:** `VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION`

When enabled, `vite:build` won't be run [automatically][deployment]
when the `assets:precompile` rake task is run, allowing you to fully customize
your deployment.
## SSR Options (experimental)
_Vite Ruby_ supports building your app in [SSR mode], obtaining a Node.js app
Expand Down
6 changes: 5 additions & 1 deletion docs/src/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ running `assets:precompile`.
This allows you to skip installation in servers that won't precompile assets, or
easily prune them after assets have been precompiled.

You can opt-out by setting the [`VITE_RUBY_SKIP_INSTALL_DEV_DEPENDENCIES`](/config/#skip-install-dev-dependencies)
environment variable to `true`.

## Disabling extension of the `assets:precompile` task

During complex migrations, it might be convenient that `vite:build` is not run
along the `assets:precompile` rake task.

You can disable the extension of the `assets:precompile` rake task by setting
the `VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION` environment variable to `true`.
the [`VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION`](/config/#skip-assets-precompile-extension)
environment variable to `true`.

## Compressing Assets 📦

Expand Down

0 comments on commit 943969d

Please sign in to comment.