Commit b604e2a5 authored by Savvas's avatar Savvas

Initialize the Stimulus Project

Stimulus is awesome as well
and in order to pair it with jekyll
we copy some files from https://github.com/stimulusjs/stimulus-starter.

Files are
 - .babelrc
 - package.json
 - src/ (directory)
 - webpack.config.js
parent dec78910
{
"plugins": ["transform-class-properties"],
"presets": [
["env", { "modules": false }]
]
}
{
"name": "stimulus-starter",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"start": "node server.js"
},
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.1",
"express": "^4.16.2",
"stimulus": "^1.0.0",
"webpack-dev-middleware": "^2.0.3"
},
"devDependencies": {
"webpack": "^3.11.0"
}
}
const path = require("path")
const express = require("express")
const webpack = require("webpack")
const webpackMiddleware = require("webpack-dev-middleware")
const webpackConfig = require("./webpack.config")
const app = express()
const publicPath = path.join(__dirname, "public")
const port = process.env.PORT || 9000
app.use(express.static(publicPath))
app.use(webpackMiddleware(webpack(webpackConfig)))
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})
import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"
const application = Application.start()
const context = require.context("./controllers", true, /\.js$/)
application.load(definitionsFromContext(context))
const path = require("path")
module.exports = {
entry: {
bundle: "./src/index.js"
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "public")
},
devtool: "source-map",
module: {
rules: [
{
test: /\.js$/,
exclude: [
/node_modules/
],
use: [
{ loader: "babel-loader" }
]
}
]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment