Class: StimulusPlumbers::Tailwind::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Generators::CssEntrypoint
Defined in:
lib/generators/stimulus_plumbers/tailwind/install/install_generator.rb

Constant Summary collapse

GEM_NAME =
"stimulus_plumbers_tailwind"
LIB_DIR =
File.expand_path("../../../..", __dir__)
TAILWIND_CSS_FILE =
"TAILWIND_CSS_FILE"
CSS_CANDIDATES =
%w[
  app/assets/stylesheets/application.tailwind.css
  app/assets/stylesheets/application.css
  app/javascript/entrypoints/application.css
].freeze

Instance Method Summary collapse

Instance Method Details

#installObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/stimulus_plumbers/tailwind/install/install_generator.rb', line 22

def install
  css_file = entry_css_file(**css_file_lookup_options)
  return warn_entry_css_not_found(label: "Tailwind CSS", **css_file_lookup_options) unless css_file

  apply_edit(
    css_file,
    StimulusPlumbers::Generators::TokensDirective.directive,
    stale_pattern: StimulusPlumbers::Generators::TokensDirective.stale_pattern
  )
  apply_edit(
    css_file,
    source_directive,
    anchor_pattern: source_anchor_pattern,
    stale_pattern:  source_stale_pattern
  )
end