Class: AdministrateTailwindTheme::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/administrate_tailwind_theme/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/administrate_tailwind_theme/install/install_generator.rb', line 14

def create_initializer
  initializer 'administrate_tailwind_theme.rb', <<~FILE
    # frozen_string_literal: true

    require 'administrate'
    Administrate::Engine.stylesheets.clear # required to remove Administrate base styles

    AdministrateTailwindTheme::Configuration.configure do |config|
      config.flowbite = #{flowbite?}
    end
  FILE
end

#create_or_update_administrate_layoutObject



27
28
29
30
31
32
# File 'lib/generators/administrate_tailwind_theme/install/install_generator.rb', line 27

def create_or_update_administrate_layout
  tailwind_config_path = 'config/tailwind.config.js'

  insert_tailwind_config(tailwind_config_path)
  insert_flowbite_config(tailwind_config_path) if flowbite?
end

#install_flowbiteObject



7
8
9
10
11
12
# File 'lib/generators/administrate_tailwind_theme/install/install_generator.rb', line 7

def install_flowbite
  return unless flowbite?

  validate_npm
  install_flowbite_package
end