Add webpack #1
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
clientpack/**
|
||||
node_modules/**
|
23
.vscode/tasks.json
vendored
Normal file
23
.vscode/tasks.json
vendored
Normal 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"]
|
||||
}
|
||||
]
|
||||
}
|
16
Makefile
16
Makefile
@ -28,20 +28,12 @@ clean:
|
||||
rm -f ./bindata.go
|
||||
|
||||
bindata.go: client client/*
|
||||
rm -fr ./clientpack
|
||||
cp -r ./client ./clientpack
|
||||
( echo ';(function() {' ; cat clientpack/dcwebui.js ; echo '})();' ) | uglifyjs -o clientpack/dcwebui.min.js -c -m --ie8
|
||||
lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css
|
||||
cat clientpack/index.htm \
|
||||
| sed -e '/dcwebui.css/{i <style>' -e 'r clientpack/dcwebui.min.css' -e 'a </style>' -e 'd}' \
|
||||
| sed -e '/dcwebui.js/{i <script>' -e 'r clientpack/dcwebui.min.js' -e 'a </script>' -e 'd}' \
|
||||
| sed -e '/socket.io-1.7.2.js/{i <script>' -e 'r clientpack/socket.io-1.7.2.js' -e 'a </script>' -e 'd}' \
|
||||
> clientpack/index.packed.htm
|
||||
mv clientpack/index.packed.htm clientpack/index.htm
|
||||
npm run webpack
|
||||
cat client/index.htm \
|
||||
| sed -e '/bundle.js/{i <script>' -e 'r clientpack/bundle.min.js' -e 'a </script>' -e 'd}' \
|
||||
> clientpack/index.htm
|
||||
html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm
|
||||
mv clientpack/index.min.htm clientpack/index.htm
|
||||
rm ./clientpack/*.js
|
||||
rm ./clientpack/*.css
|
||||
go-bindata -nomemcopy -nometadata -prefix clientpack clientpack
|
||||
|
||||
$(BINNAME).exe: bindata.go *.go
|
||||
|
@ -1,5 +1,8 @@
|
||||
/* dcwebui.js */
|
||||
|
||||
require("./dcwebui.css");
|
||||
require("./socket.io-1.7.2.js");
|
||||
|
||||
"use strict";
|
||||
|
||||
var SENTINEL_PASSWORD = "************";
|
||||
|
@ -5,8 +5,7 @@
|
||||
<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="apple-mobile-web-app-capable" content="yes">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<link rel="stylesheet" href="/dcwebui.css">
|
||||
<link rel="apple-touch-icon" href="./apple-touch-icon.png">
|
||||
<title>Loading...</title>
|
||||
</head>
|
||||
<body>
|
||||
@ -56,7 +55,6 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/socket.io-1.7.2.js"></script>
|
||||
<script type="text/javascript" src="/dcwebui.js"></script>
|
||||
<script type="text/javascript" src="/bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
28
package.json
Normal file
28
package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "nmdc-webfrontend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "s",
|
||||
"scripts": {
|
||||
"webpack": "webpack"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.ivysaur.me/code.ivysaur.me/nmdc-webfrontend"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"awesome-typescript-loader": "^3.3.0",
|
||||
"css-loader": "^0.28.7",
|
||||
"html-minifier": "^3.5.6",
|
||||
"less": "^2.7.3",
|
||||
"less-plugin-clean-css": "^1.5.1",
|
||||
"style-loader": "^0.19.0",
|
||||
"uglify-js": "^3.1.8",
|
||||
"typescript": "^2.6.1",
|
||||
"webpack": "^3.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
}
|
||||
}
|
21
webpack.config.js
Normal file
21
webpack.config.js
Normal 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
|
||||
}
|
||||
})
|
||||
]
|
||||
};
|
Loading…
Reference in New Issue
Block a user