Module: StimulusPlumbers::Tailwind::Generators::AnimationsDirective

Defined in:
lib/stimulus_plumbers/tailwind/generators/animations_directive.rb

Constant Summary collapse

ANIMATIONS_CSS_PATH =
"app/assets/stylesheets/stimulus_plumbers/tailwind/animations.css"

Class Method Summary collapse

Class Method Details

.anchor_patternObject

Anchors right after the core tokens.css import so the two asset imports stay grouped, ahead of the tailwindcss import and @source lines.



22
23
24
# File 'lib/stimulus_plumbers/tailwind/generators/animations_directive.rb', line 22

def anchor_pattern
  %r{@import "[^"]*tokens\.css";}
end

.directive(from:, destination_root:) ⇒ Object



13
14
15
16
17
18
# File 'lib/stimulus_plumbers/tailwind/generators/animations_directive.rb', line 13

def directive(from:, destination_root:)
  path = Pathname.new(destination_root).join(ANIMATIONS_CSS_PATH)
  rel  = path.relative_path_from(Pathname.new(from))
  rel  = "./#{rel}" unless rel.to_s.start_with?(".", "/")
  %(@import "#{rel}";)
end

.stale_patternObject



26
27
28
# File 'lib/stimulus_plumbers/tailwind/generators/animations_directive.rb', line 26

def stale_pattern
  %r{@import "[^"]*#{Regexp.escape(ANIMATIONS_CSS_PATH)}";}
end