build: 🔧 Stimulus setup

webpack service added to docker-compose, rails webpacker config, application js and css tags updated

rails webpacker support
This commit is contained in:
Juan Rodriguez
2021-06-13 16:28:45 -05:00
parent d27fb94095
commit 7e81f47473
32 changed files with 7731 additions and 73 deletions
@@ -0,0 +1,18 @@
// 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"
export default class extends Controller {
static targets = [ "output" ]
connect() {
this.outputTarget.textContent = 'Hello, Stimulus!'
}
}
+9
View File
@@ -0,0 +1,9 @@
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.
import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"
const application = Application.start()
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))
View File
+23
View File
@@ -0,0 +1,23 @@
/* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)
//= require turbolinks
console.log('Hello World from Webpacker')
import "controllers"
import "stylesheets"
+3
View File
@@ -0,0 +1,3 @@
.btn {
background-color: green;
}