baarkerlounger
3 years ago
5 changed files with 22 additions and 25 deletions
@ -0,0 +1,10 @@
|
||||
import { Application } from "@hotwired/stimulus" |
||||
|
||||
const application = Application.start() |
||||
|
||||
// Configure Stimulus development experience
|
||||
application.warnings = true |
||||
application.debug = false |
||||
window.Stimulus = application |
||||
|
||||
export { application } |
@ -1,18 +1,7 @@
|
||||
// Visit The Stimulus Handbook for more details
|
||||
// https://stimulusjs.org/handbook/introduction
|
||||
//
|
||||
// This example controller works with specially annotated HTML like:
|
||||
//
|
||||
// <div data-controller="hello">
|
||||
// <h1 data-target="hello.output"></h1>
|
||||
// </div>
|
||||
|
||||
import { Controller } from "stimulus" |
||||
import { Controller } from "@hotwired/stimulus" |
||||
|
||||
export default class extends Controller { |
||||
static targets = [ "output" ] |
||||
|
||||
connect() { |
||||
this.outputTarget.textContent = 'Hello, Stimulus!' |
||||
this.element.textContent = "Hello World!" |
||||
} |
||||
} |
||||
|
@ -1,9 +1,7 @@
|
||||
// Load all the controllers within this directory and all subdirectories.
|
||||
// Controller files must be named *_controller.js.
|
||||
// This file is auto-generated by ./bin/rails stimulus:manifest:update
|
||||
// Run that command whenever you add a new controller
|
||||
|
||||
import { Application } from "stimulus" |
||||
import { definitionsFromContext } from "stimulus/webpack-helpers" |
||||
import { application } from "./application" |
||||
|
||||
const application = Application.start() |
||||
const context = require.context("controllers", true, /_controller\.js$/) |
||||
application.load(definitionsFromContext(context)) |
||||
import HelloController from "./hello_controller" |
||||
application.register("hello", HelloController) |
||||
|
Loading…
Reference in new issue