- Replace unpkg CDN with npm package import in application.js - Add global initialization for all Lucide icons on page load and Turbo events - Remove dependency on lucide_controller.js and data-controller wrapper - Icons now work anywhere with simple <i data-lucide="icon-name"></i> syntax - Bundle size increased to include full icon set but removes controller overhead 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
24 lines
756 B
JavaScript
Executable File
24 lines
756 B
JavaScript
Executable File
// Entry point for the build script in your package.json
|
|
// This file initializes the Rails application with Turbo and Stimulus controllers
|
|
|
|
// Import Turbo Rails for SPA-like navigation
|
|
import "@hotwired/turbo-rails";
|
|
|
|
// Import all Stimulus controllers
|
|
import "./controllers";
|
|
|
|
// Import and initialize Lucide icons globally
|
|
import { createIcons, icons } from 'lucide';
|
|
|
|
// Initialize icons globally
|
|
function initializeLucideIcons() {
|
|
createIcons({ icons });
|
|
}
|
|
|
|
// Run on initial page load
|
|
document.addEventListener('DOMContentLoaded', initializeLucideIcons);
|
|
|
|
// Run on Turbo navigation (Rails 7+ SPA behavior)
|
|
document.addEventListener('turbo:render', initializeLucideIcons);
|
|
document.addEventListener('turbo:frame-render', initializeLucideIcons);
|