Class: Lilac::CLI::PreviewServer
- Inherits:
-
Object
- Object
- Lilac::CLI::PreviewServer
- Defined in:
- lib/lilac/cli/preview_server.rb
Overview
Static server for the lilac build output. The intent is "ship-
parity preview": serve dist/ as a CDN / static host would, with
no file watcher, no live reload, no rebuild. Use this to verify
the production-mode (default --target compiled) output before
deploy.
Mirrors vite preview semantics: separate command, separate
default port from lilac dev, no automation.
Defined Under Namespace
Classes: Error
Constant Summary collapse
- DEFAULT_HOST =
"127.0.0.1"- DEFAULT_PORT =
4173
Instance Method Summary collapse
-
#initialize(output_dir, host: DEFAULT_HOST, port: DEFAULT_PORT, out: $stdout, err: $stderr) ⇒ PreviewServer
constructor
A new instance of PreviewServer.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(output_dir, host: DEFAULT_HOST, port: DEFAULT_PORT, out: $stdout, err: $stderr) ⇒ PreviewServer
Returns a new instance of PreviewServer.
21 22 23 24 25 26 27 |
# File 'lib/lilac/cli/preview_server.rb', line 21 def initialize(output_dir, host: DEFAULT_HOST, port: DEFAULT_PORT, out: $stdout, err: $stderr) @output_dir = output_dir @host = host @port = port @out = out @err = err end |
Instance Method Details
#start ⇒ Object
29 30 31 32 33 34 |
# File 'lib/lilac/cli/preview_server.rb', line 29 def start verify_dist! @server = build_server @out.puts @server.start end |
#stop ⇒ Object
36 37 38 |
# File 'lib/lilac/cli/preview_server.rb', line 36 def stop @server&.stop end |