Class: Postnhost::TailwindCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/postnhost/tailwind_compiler.rb

Defined Under Namespace

Classes: IncompatibleVersion, MissingCompiler

Constant Summary collapse

REQUIRED_MAJOR =
4

Instance Method Summary collapse

Constructor Details

#initialize(root:, loaded_specs: Gem.loaded_specs) ⇒ TailwindCompiler

Returns a new instance of TailwindCompiler.



12
13
14
15
# File 'lib/postnhost/tailwind_compiler.rb', line 12

def initialize(root:, loaded_specs: Gem.loaded_specs)
  @root = Pathname.new(root)
  @loaded_specs = loaded_specs
end

Instance Method Details

#command(input_path:, output_path:, watch: false) ⇒ Object

Raises:



17
18
19
20
21
22
23
# File 'lib/postnhost/tailwind_compiler.rb', line 17

def command(input_path:, output_path:, watch: false)
  command = npm_command(input_path:, output_path:) || ruby_command(input_path:, output_path:)
  raise MissingCompiler, missing_compiler_message unless command

  command << "--watch" if watch
  command
end