Module: Cosensee::TailwindCommand

Defined in:
lib/cosensee/tailwind_command.rb

Overview

build TailwindCSS Command, based on github.com/rails/tailwindcss-rails

Class Method Summary collapse

Class Method Details

.compile_command(output_dir: Cosensee::DEFAULT_OUTPUT_DIR, css_dir: DEFAULT_CSS_DIR, debug: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cosensee/tailwind_command.rb', line 8

def self.compile_command(output_dir: Cosensee::DEFAULT_OUTPUT_DIR, css_dir: DEFAULT_CSS_DIR, debug: false, **)
  command = [
    Tailwindcss::Ruby.executable(**),
    '-i', File.join(__dir__, '../../assets/styles/input.css'),
    '-o', File.join(output_dir, css_dir, 'tailwind.css'),
    '-c', Cosensee::TAILWIND_CONFIG_FILE
  ]

  command << '--minify' unless debug

  postcss_path = 'postcss.config.js'
  command += ['--postcss', postcss_path.to_s] if File.exist?(postcss_path)

  command
end