Sha256: 47febc967121e8ea270111d65558e22e54168e5eccb2a33eaf1b0a4de9aa8d57
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true require "shopify_cli/theme/dev_server" module Theme class Command class Serve < ShopifyCLI::Command::SubCommand DEFAULT_HTTP_HOST = "127.0.0.1" options do |parser, flags| parser.on("--host=HOST") { |host| flags[:host] = host.to_s } parser.on("--port=PORT") { |port| flags[:port] = port.to_i } parser.on("--poll") { flags[:poll] = true } parser.on("--live-reload=MODE") { |mode| flags[:mode] = as_reload_mode(mode) } end def call(*) flags = options.flags.dup host = flags[:host] || DEFAULT_HTTP_HOST ShopifyCLI::Theme::DevServer.start(@ctx, ".", host: host, **flags) do |syncer| UI::SyncProgressBar.new(syncer).progress(:upload_theme!, delay_low_priority_files: true) end rescue ShopifyCLI::Theme::DevServer::AddressBindingError raise ShopifyCLI::Abort, ShopifyCLI::Context.message("theme.serve.error.address_binding_error", ShopifyCLI::TOOL_NAME) end def self.as_reload_mode(mode) ShopifyCLI::Theme::DevServer::ReloadMode.get!(mode) end def self.help ShopifyCLI::Context.message("theme.serve.help", ShopifyCLI::TOOL_NAME) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems