Class: Baldur::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Baldur::Generators::InstallGenerator
- Defined in:
- lib/generators/baldur/install/install_generator.rb
Constant Summary collapse
- CORE_CONTROLLERS =
%w[ accordion date_field details_menu form_submit menu_select modal marketing_pricing marketing_tabs segmented_tabs sidebar smooth_scroll snackbar theme tooltip ].freeze
- CORE_LIBS =
%w[ animation-helpers dom-helpers field-validation-helpers focus-management formatting-helpers snackbar storage-helpers ].freeze
Instance Method Summary collapse
- #add_stylesheet_import ⇒ Object
- #create_controller_shims ⇒ Object
- #create_fonts_override ⇒ Object
- #create_initializer ⇒ Object
- #create_lib_shims ⇒ Object
- #create_theme_override ⇒ Object
- #create_ui_helper ⇒ Object
Instance Method Details
#add_stylesheet_import ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/generators/baldur/install/install_generator.rb', line 67 def add_stylesheet_import return unless File.exist?(tailwind_entrypoint_path) append_unique_line tailwind_entrypoint_path, "@import \"../stylesheets/fonts.css\";" append_unique_line tailwind_entrypoint_path, "@import \"../builds/tailwind/baldur.css\";" append_unique_line tailwind_entrypoint_path, "@import \"../stylesheets/theme.css\";" ensure_stylesheet_import_order end |
#create_controller_shims ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/generators/baldur/install/install_generator.rb', line 51 def create_controller_shims CORE_CONTROLLERS.each do |name| create_file "app/javascript/controllers/#{name}_controller.js", <<~JS export { default } from "baldur/controllers/#{name}_controller" JS end end |
#create_fonts_override ⇒ Object
47 48 49 |
# File 'lib/generators/baldur/install/install_generator.rb', line 47 def create_fonts_override template "fonts.css", "app/assets/stylesheets/fonts.css" end |
#create_initializer ⇒ Object
39 40 41 |
# File 'lib/generators/baldur/install/install_generator.rb', line 39 def create_initializer template "baldur_initializer.rb", "config/initializers/baldur.rb" end |
#create_lib_shims ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/generators/baldur/install/install_generator.rb', line 59 def create_lib_shims CORE_LIBS.each do |name| create_file "app/javascript/lib/#{name}.js", <<~JS export * from "baldur/lib/#{name}" JS end end |
#create_theme_override ⇒ Object
43 44 45 |
# File 'lib/generators/baldur/install/install_generator.rb', line 43 def create_theme_override template "theme.css", "app/assets/stylesheets/theme.css" end |
#create_ui_helper ⇒ Object
35 36 37 |
# File 'lib/generators/baldur/install/install_generator.rb', line 35 def create_ui_helper template "ui_helper.rb", "app/helpers/ui_helper.rb" end |