Install webpack and create a webpack config

This commit is contained in:
hanneshdc 2017-11-10 20:38:47 +13:00
parent fcddbf85b0
commit 29bcf75470
5 changed files with 55 additions and 5 deletions

23
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,23 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "npm",
"isShellCommand": true,
"showOutput": "always",
"suppressTaskName": true,
"tasks": [
{
"taskName": "install",
"args": ["install"]
},
{
"taskName": "update",
"args": ["update"]
},
{
"taskName": "test",
"args": ["run", "test"]
}
]
}

View File

@ -1,5 +1,8 @@
/* dcwebui.js */ /* dcwebui.js */
require("./dcwebui.css");
require("./socket.io-1.7.2.js");
"use strict"; "use strict";
var SENTINEL_PASSWORD = "************"; var SENTINEL_PASSWORD = "************";

View File

@ -5,8 +5,7 @@
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" href="./apple-touch-icon.png">
<link rel="stylesheet" href="/dcwebui.css">
<title>Loading...</title> <title>Loading...</title>
</head> </head>
<body> <body>
@ -56,7 +55,6 @@
</form> </form>
</div> </div>
<script type="text/javascript" src="/socket.io-1.7.2.js"></script> <script type="text/javascript" src="/bundle.js"></script>
<script type="text/javascript" src="/dcwebui.js"></script>
</body> </body>
</html> </html>

View File

@ -4,7 +4,7 @@
"description": "", "description": "",
"main": "s", "main": "s",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "build": "webpack && cp client/index.htm clientpack"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -13,9 +13,14 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"css-loader": "^0.28.7",
"html-minifier": "^3.5.6", "html-minifier": "^3.5.6",
"less": "^2.7.3", "less": "^2.7.3",
"less-plugin-clean-css": "^1.5.1", "less-plugin-clean-css": "^1.5.1",
"style-loader": "^0.19.0",
"uglify-js": "^3.1.8" "uglify-js": "^3.1.8"
},
"devDependencies": {
"webpack": "^3.8.1"
} }
} }

21
webpack.config.js Normal file
View File

@ -0,0 +1,21 @@
var webpack = require("webpack");
module.exports = {
entry: "./client/dcwebui.js",
output: {
path: __dirname,
filename: "clientpack/bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
};