From 943969d77b19546eba558d0afcafa22ef0dedc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Mussini?= Date: Fri, 7 Jun 2024 11:58:01 -0300 Subject: [PATCH] docs: add environment variables section (#465) --- docs/src/config/index.md | 40 ++++++++++++++++++++++++++++-------- docs/src/guide/deployment.md | 6 +++++- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/docs/src/config/index.md b/docs/src/config/index.md index 315a07cc..c5fd69f8 100644 --- a/docs/src/config/index.md +++ b/docs/src/config/index.md @@ -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 @@ -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 [root]). - - Not supported in the JSON file. - ### devServerConnectTimeout - **Default:** `0.01` (seconds) @@ -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 [root]). + +### `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 diff --git a/docs/src/guide/deployment.md b/docs/src/guide/deployment.md index 4ee73ade..f47dbaf6 100644 --- a/docs/src/guide/deployment.md +++ b/docs/src/guide/deployment.md @@ -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 📦