Commit c3a1f19

mokha <mokha@cisco.com>
2018-01-26 22:40:25
hook up stimulus js.
1 parent 30c0fa8
Changed files (4)
app/javascript/packs/controllers/hello_controller.js
@@ -0,0 +1,4 @@
+import { Controller } from 'stimulus'
+
+export default class extends Controller {
+}
app/javascript/packs/application.js
@@ -7,5 +7,11 @@
 // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
 // layout file, like app/views/layouts/application.html.erb
 
-import "../../assets/stylesheets/application.css"
 console.log('Hello World from Webpacker')
+
+import { Application } from "stimulus"
+import { autoload } from "stimulus/webpack-helpers"
+
+const application = Application.start()
+const controllers = require.context("./controllers", true, /\.js$/)
+autoload(controllers, application)
package.json
@@ -2,7 +2,8 @@
   "name": "proof",
   "private": true,
   "dependencies": {
-    "@rails/webpacker": "^3.2.1"
+    "@rails/webpacker": "^3.2.1",
+    "stimulus": "^0.9.0"
   },
   "devDependencies": {
     "webpack-dev-server": "^2.11.1"
yarn.lock
@@ -31,6 +31,26 @@
     webpack "^3.10.0"
     webpack-manifest-plugin "^1.3.2"
 
+"@stimulus/core@^0.9.0":
+  version "0.9.0"
+  resolved "https://registry.yarnpkg.com/@stimulus/core/-/core-0.9.0.tgz#b6a0e7836b6e88fe6ea0c2055cc10b47f3a2b2ee"
+  dependencies:
+    "@stimulus/mutation-observers" "^0.9.0"
+
+"@stimulus/multimap@^0.9.0":
+  version "0.9.0"
+  resolved "https://registry.yarnpkg.com/@stimulus/multimap/-/multimap-0.9.0.tgz#ed63699b3efb273411c118a50955569b2565a6e8"
+
+"@stimulus/mutation-observers@^0.9.0":
+  version "0.9.0"
+  resolved "https://registry.yarnpkg.com/@stimulus/mutation-observers/-/mutation-observers-0.9.0.tgz#f2249b660d9c3c8a4a43bc2c66dcb8b18d2c8f0c"
+  dependencies:
+    "@stimulus/multimap" "^0.9.0"
+
+"@stimulus/webpack-helpers@^0.9.0":
+  version "0.9.0"
+  resolved "https://registry.yarnpkg.com/@stimulus/webpack-helpers/-/webpack-helpers-0.9.0.tgz#b655c233015bea0d02b66ec709ef15b4b0060a57"
+
 abbrev@1:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
@@ -5333,6 +5353,13 @@ stdout-stream@^1.4.0:
   dependencies:
     readable-stream "^2.0.1"
 
+stimulus@^0.9.0:
+  version "0.9.0"
+  resolved "https://registry.yarnpkg.com/stimulus/-/stimulus-0.9.0.tgz#4e9f994fdf6df261913221b149451d6ad1a54b30"
+  dependencies:
+    "@stimulus/core" "^0.9.0"
+    "@stimulus/webpack-helpers" "^0.9.0"
+
 stream-browserify@^2.0.1:
   version "2.0.1"
   resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db"