Class: Maquina::TailwindConfigGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/maquina/tailwind_config/tailwind_config_generator.rb

Instance Method Summary collapse

Instance Method Details

#configure_cssObject



17
18
19
20
21
22
23
# File 'lib/generators/maquina/tailwind_config/tailwind_config_generator.rb', line 17

def configure_css
  copy_file "app/assets/stylesheets/maquina.css"

  inject_into_file "app/assets/stylesheets/application.tailwind.css", after: /base"?;/ do
    %(\n@import "./maquina.css";)
  end
end

#create_generatorObject



7
8
9
10
11
12
13
14
15
# File 'lib/generators/maquina/tailwind_config/tailwind_config_generator.rb', line 7

def create_generator
  tailwind_config_file = "lib/generators/tailwind_config/templates/config/tailwind.config.js.tt"

  template "lib/tasks/tailwind.rake"
  template "lib/generators/tailwind_config/tailwind_config_generator.rb"

  # Seems that template can't handle .tt.tt extensions correctly
  copy_file tailwind_config_file, tailwind_config_file
end