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

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

Constant Summary collapse

GEM_ROOT =
File.expand_path("../../../..", __dir__)
ANIMATIONS_CSS_REL_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:) ⇒ Object



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

def directive(from:)
  path = Pathname.new(GEM_ROOT).join(ANIMATIONS_CSS_REL_PATH)
  rel  = path.relative_path_from(Pathname.new(from))
  %(@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_REL_PATH)}";}
end