Class: Lilac::CLI::Subcommand::Build
- Defined in:
- lib/lilac/cli/subcommand/build.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Lilac::CLI::Subcommand::Base
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lilac/cli/subcommand/build.rb', line 12 def run opts = parse_opts config = Config.load( root: opts[:root], components_dir: opts[:components], pages_dir: opts[:pages], output_dir: opts[:output], public_dir: opts[:public], build_target: opts[:target], mrbc_path: opts[:mrbc_path], lilac_compiled_path: opts[:lilac_compiled_path], lilac_full_path: opts[:lilac_full_path], mruby_wasm_js_path: opts[:mruby_wasm_js_path], ) # Default to clean: stale per-page `.mrb` (whose content hash # changed across builds) would otherwise accumulate, and most # modern build tools (Vite / Next / Eleventy / Webpack 5) # follow the same convention. Opt out with `--no-clean` for # incremental inspection or when something outside Lilac # populates the same dist directory. clean_output_dir!(config.output_dir, project_root: config.root) unless opts[:clean] == false result = Builder.from_config(config).build public_suffix = result[:public_files].positive? ? " + #{result[:public_files]} static file(s)" : "" @out.puts "Built #{result[:pages]} page(s) from #{result[:components]} component(s)#{public_suffix} " \ "→ #{relative(config.output_dir)} (target: #{config.build_target})" 0 end |