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 confirmation date_field details_menu form_submit menu_select modal marketing_pricing marketing_tabs mobile_sidebar 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
69 70 71 72 73 74 75 76 |
# File 'lib/generators/baldur/install/install_generator.rb', line 69 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
53 54 55 56 57 58 59 |
# File 'lib/generators/baldur/install/install_generator.rb', line 53 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
49 50 51 |
# File 'lib/generators/baldur/install/install_generator.rb', line 49 def create_fonts_override template "fonts.css", "app/assets/stylesheets/fonts.css" end |
#create_initializer ⇒ Object
41 42 43 |
# File 'lib/generators/baldur/install/install_generator.rb', line 41 def create_initializer template "baldur_initializer.rb", "config/initializers/baldur.rb" end |
#create_lib_shims ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/generators/baldur/install/install_generator.rb', line 61 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
45 46 47 |
# File 'lib/generators/baldur/install/install_generator.rb', line 45 def create_theme_override template "theme.css", "app/assets/stylesheets/theme.css" end |
#create_ui_helper ⇒ Object
37 38 39 |
# File 'lib/generators/baldur/install/install_generator.rb', line 37 def create_ui_helper template "ui_helper.rb", "app/helpers/ui_helper.rb" end |