Class: Inertia::Configuration
- Inherits:
-
Object
- Object
- Inertia::Configuration
- Defined in:
- lib/inertia/configuration.rb
Overview
Stores global configuration options for the Inertia integration.
Defined Under Namespace
Classes: DevServer
Instance Method Summary collapse
-
#build_on_start=(value) ⇒ Object
Set whether to build frontend assets on server start.
-
#build_on_start? ⇒ Boolean
Returns whether frontend assets should be built when the server starts.
-
#build_path ⇒ Pathname?
Returns the configured build output path.
-
#build_path=(path) ⇒ Object
Sets the path where built frontend assets are located.
-
#dev_server ⇒ DevServer
Returns the dev server configuration.
-
#frontend_path ⇒ Pathname?
Returns the configured frontend directory path.
-
#frontend_path=(path) ⇒ Object
Sets the path to the frontend application directory.
Instance Method Details
#build_on_start=(value) ⇒ Object
Set whether to build frontend assets on server start.
27 28 29 |
# File 'lib/inertia/configuration.rb', line 27 def build_on_start=(value) @build_on_start = value end |
#build_on_start? ⇒ Boolean
Returns whether frontend assets should be built when the server starts.
Defaults to true in non-development environments.
36 37 38 |
# File 'lib/inertia/configuration.rb', line 36 def build_on_start? !!@build_on_start end |
#build_path ⇒ Pathname?
Returns the configured build output path.
62 63 64 |
# File 'lib/inertia/configuration.rb', line 62 def build_path @build_path end |
#build_path=(path) ⇒ Object
This setting should be paired with updating the build.outDir option in your Vite config.
Sets the path where built frontend assets are located.
When set, this overrides the default dist directory inside #frontend_path.
The path should be relative to the application root.
Building directly into public/ is not supported because a root-level
index.html would intercept all requests to the application's / endpoint.
Use a nested directory instead, e.g., public/dist.
78 79 80 81 82 83 84 |
# File 'lib/inertia/configuration.rb', line 78 def build_path=(path) @build_path = Rage.root.join(path) if @build_path == Rage.root.join("public") raise ArgumentError, "build_path cannot be set to public/; use a nested directory instead, e.g., public/dist" end end |
#dev_server ⇒ DevServer
Returns the dev server configuration.
89 90 91 |
# File 'lib/inertia/configuration.rb', line 89 def dev_server @dev_server ||= DevServer.new end |
#frontend_path ⇒ Pathname?
Returns the configured frontend directory path.
44 45 46 |
# File 'lib/inertia/configuration.rb', line 44 def frontend_path @frontend_path end |
#frontend_path=(path) ⇒ Object
Sets the path to the frontend application directory.
When set, this overrides automatic Vite config detection. The path should be relative to the application root.
54 55 56 |
# File 'lib/inertia/configuration.rb', line 54 def frontend_path=(path) @frontend_path = Rage.root.join(path) end |