Class: ShopifyThemeBuilder::Watcher

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_theme_builder/watcher.rb

Overview

Watcher is responsible for monitoring specified folders for changes and triggering the build process for Shopify theme components.

Instance Method Summary collapse

Constructor Details

#initialize(folders_to_watch: ["_components"], tailwind_input_file: "./assets/tailwind.css", tailwind_output_file: "./assets/tailwind-output.css", skip_tailwind: false, stimulus_output_file: "./assets/controllers.js") ⇒ Watcher

Returns a new instance of Watcher.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/shopify_theme_builder/watcher.rb', line 10

def initialize(
  folders_to_watch: ["_components"],
  tailwind_input_file: "./assets/tailwind.css",
  tailwind_output_file: "./assets/tailwind-output.css",
  skip_tailwind: false,
  stimulus_output_file: "./assets/controllers.js"
)
  @folders_to_watch = folders_to_watch
  @tailwind_input_file = tailwind_input_file
  @tailwind_output_file = tailwind_output_file
  @skip_tailwind = skip_tailwind
  @stimulus_output_file = stimulus_output_file
  @stimulus_controller_file = ShopifyThemeBuilder::LiquidProcessor::SUPPORTED_FILES[:stimulus]
end

Instance Method Details

#watch ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/shopify_theme_builder/watcher.rb', line 25

def watch
  create_folders

  initial_build

  create_tailwind_file

  run_tailwind

  run_stimulus

  watch_folders
end