gem "live_component", "~> 1.0"
gem "live_component", "~> 1.0"
bundle add live_componentbundle add live_componentbin/rails generate live_component:installbin/rails generate live_component:installNote that the rest of this guide assumes you have not run the Rails generator described above. If you chose to run the generator, you may skip the rest of the steps below.
"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 "live_component" Rails.application.config.middleware.insert_before(0, LiveComponent::Middleware)
require "live_component" Rails.application.config.middleware.insert_before(0, LiveComponent::Middleware)
// 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);