gem "live_component", "~> 1.0"
gem "live_component", "~> 1.0"
bundle add live_componentbundle add live_component"dependencies": { "@camertron/live-component": "^1.0.0" }
"dependencies": { "@camertron/live-component": "^1.0.0" }
npm add @camertron/live-component --save
npm add @camertron/live-component --save
require_relative "config/environment" require "live_component/middleware" # <-- add this line use LiveComponent::Middleware # <-- add this line run Rails.application Rails.application.load_server
require_relative "config/environment" require "live_component/middleware" # <-- add this line use LiveComponent::Middleware # <-- add this line run Rails.application Rails.application.load_server
module MyRailsApp class Application < Rails::Application config.middleware.insert_before 0, LiveComponent::Middleware end end
module MyRailsApp class Application < Rails::Application config.middleware.insert_before 0, LiveComponent::Middleware end end
// Import with aliases to distinguish the two Application classes import { Application as LiveComponentApplication } from "@camertron/live-component"; import { Application as StimulusApplication } from "@hotwired/stimulus"; // Add some declarations on window to make the TypeScript compiler happy declare global { interface Window { Stimulus: StimulusApplication; Live: LiveComponentApplication; } } // Start both the Stimulus and LiveComponent applications window.Stimulus = StimulusApplication.start(); window.Live = LiveComponentApplication.start(window.Stimulus);
// Import with aliases to distinguish the two Application classes import { Application as LiveComponentApplication } from "@camertron/live-component"; import { Application as StimulusApplication } from "@hotwired/stimulus"; // Add some declarations on window to make the TypeScript compiler happy declare global { interface Window { Stimulus: StimulusApplication; Live: LiveComponentApplication; } } // Start both the Stimulus and LiveComponent applications window.Stimulus = StimulusApplication.start(); window.Live = LiveComponentApplication.start(window.Stimulus);