From 80d64e04441ced7caecd238ae232e749d8e0dddf Mon Sep 17 00:00:00 2001 From: realtradam Date: Tue, 21 May 2024 23:32:53 -0400 Subject: initial setup of seperating frontend --- src/controllers/application.js | 9 +++++++++ src/controllers/hello_controller.js | 7 +++++++ src/controllers/index.js | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 src/controllers/application.js create mode 100644 src/controllers/hello_controller.js create mode 100644 src/controllers/index.js (limited to 'src/controllers') diff --git a/src/controllers/application.js b/src/controllers/application.js new file mode 100644 index 0000000..1213e85 --- /dev/null +++ b/src/controllers/application.js @@ -0,0 +1,9 @@ +import { Application } from "@hotwired/stimulus" + +const application = Application.start() + +// Configure Stimulus development experience +application.debug = false +window.Stimulus = application + +export { application } diff --git a/src/controllers/hello_controller.js b/src/controllers/hello_controller.js new file mode 100644 index 0000000..5975c07 --- /dev/null +++ b/src/controllers/hello_controller.js @@ -0,0 +1,7 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + connect() { + this.element.textContent = "Hello World!" + } +} diff --git a/src/controllers/index.js b/src/controllers/index.js new file mode 100644 index 0000000..d0685d3 --- /dev/null +++ b/src/controllers/index.js @@ -0,0 +1,8 @@ +// This file is auto-generated by ./bin/rails stimulus:manifest:update +// Run that command whenever you add a new controller or create them with +// ./bin/rails generate stimulus controllerName + +import { application } from "./application" + +import HelloController from "./hello_controller" +application.register("hello", HelloController) -- cgit v1.2.3