Class: LocoMotion::Generators::InstallGenerator

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

Overview

Installs LocoMotion's default icon set (Heroicons) into the host application by syncing the SVGs into app/assets/svg/icons, where the loco_icon helper resolves them. Run this once as part of setup:

bin/rails generate loco_motion:install

Pass library names to install others at the same time:

bin/rails generate loco_motion:install lucide phosphor

Instance Method Summary collapse

Instance Method Details

#sync_iconsObject



25
26
27
28
29
30
31
# File 'lib/generators/loco_motion/install_generator.rb', line 25

def sync_icons
  target = ::File.join(destination_root, "app/assets/svg/icons")

  say "Syncing #{libraries.join(', ')} into app/assets/svg/icons ...", :green
  LocoMotion::Icons::Installer.add(libraries, target: target)
  say "✓ Synced #{libraries.join(', ')}. Commit the SVGs to your repo.", :green
end