use webpack for content inlining and html minification (WIP)

This commit is contained in:
mappu 2017-11-12 11:46:34 +13:00
parent d5f6a5f2cb
commit 178388becc
4 changed files with 252 additions and 4 deletions

View File

@ -54,7 +54,5 @@
</div>
</form>
</div>
<script type="text/javascript" src="/bundle.js"></script>
</body>
</html>

236
package-lock.json generated
View File

@ -371,11 +371,21 @@
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz",
"integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE="
},
"bluebird": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
"integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
},
"bn.js": {
"version": "4.11.8",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
"integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA=="
},
"boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"boom": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
@ -923,6 +933,17 @@
"source-list-map": "2.0.0"
}
},
"css-select": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
"integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=",
"requires": {
"boolbase": "1.0.0",
"css-what": "2.1.0",
"domutils": "1.5.1",
"nth-check": "1.0.1"
}
},
"css-selector-tokenizer": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz",
@ -933,6 +954,11 @@
"regexpu-core": "1.0.0"
}
},
"css-what": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz",
"integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0="
},
"cssesc": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz",
@ -1071,11 +1097,64 @@
"randombytes": "2.0.5"
}
},
"dom-converter": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.1.4.tgz",
"integrity": "sha1-pF71cnuJDJv/5tfIduexnLDhfzs=",
"requires": {
"utila": "0.3.3"
},
"dependencies": {
"utila": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/utila/-/utila-0.3.3.tgz",
"integrity": "sha1-1+jn1+MJEHCSsF+NloiCTWM6QiY="
}
}
},
"dom-serializer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
"integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=",
"requires": {
"domelementtype": "1.1.3",
"entities": "1.1.1"
},
"dependencies": {
"domelementtype": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz",
"integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs="
}
}
},
"domain-browser": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz",
"integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw="
},
"domelementtype": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz",
"integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI="
},
"domhandler": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.1.0.tgz",
"integrity": "sha1-0mRvXlf2w7qxHPbLBdPArPdBJZQ=",
"requires": {
"domelementtype": "1.3.0"
}
},
"domutils": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
"integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=",
"requires": {
"dom-serializer": "0.1.0",
"domelementtype": "1.3.0"
}
},
"ecc-jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
@ -1150,6 +1229,11 @@
"tapable": "0.2.8"
}
},
"entities": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz",
"integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA="
},
"errno": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz",
@ -1732,6 +1816,74 @@
"uglify-js": "3.1.9"
}
},
"html-webpack-plugin": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-2.30.1.tgz",
"integrity": "sha1-f5xCG36pHsRg9WUn1430hO51N9U=",
"requires": {
"bluebird": "3.5.1",
"html-minifier": "3.5.6",
"loader-utils": "0.2.17",
"lodash": "4.17.4",
"pretty-error": "2.1.1",
"toposort": "1.0.6"
},
"dependencies": {
"loader-utils": {
"version": "0.2.17",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz",
"integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=",
"requires": {
"big.js": "3.2.0",
"emojis-list": "2.1.0",
"json5": "0.5.1",
"object-assign": "4.1.1"
}
}
}
},
"htmlparser2": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz",
"integrity": "sha1-zHDQWln2VC5D8OaFyYLhTJJKnv4=",
"requires": {
"domelementtype": "1.3.0",
"domhandler": "2.1.0",
"domutils": "1.1.6",
"readable-stream": "1.0.34"
},
"dependencies": {
"domutils": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.1.6.tgz",
"integrity": "sha1-vdw94Jm5ou+sxRxiPyj0FuzFdIU=",
"requires": {
"domelementtype": "1.3.0"
}
},
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"readable-stream": {
"version": "1.0.34",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "0.0.1",
"string_decoder": "0.10.31"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
}
}
},
"http-signature": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
@ -2590,6 +2742,14 @@
"path-key": "2.0.1"
}
},
"nth-check": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz",
"integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=",
"requires": {
"boolbase": "1.0.0"
}
},
"num2fraction": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz",
@ -3354,6 +3514,15 @@
"resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
"integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks="
},
"pretty-error": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz",
"integrity": "sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=",
"requires": {
"renderkid": "2.0.1",
"utila": "0.4.0"
}
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -3582,6 +3751,25 @@
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8="
},
"renderkid": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/renderkid/-/renderkid-2.0.1.tgz",
"integrity": "sha1-iYyr/Ivt5Le5ETWj/9Mj5YwNsxk=",
"requires": {
"css-select": "1.2.0",
"dom-converter": "0.1.4",
"htmlparser2": "3.3.0",
"strip-ansi": "3.0.1",
"utila": "0.3.3"
},
"dependencies": {
"utila": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/utila/-/utila-0.3.3.tgz",
"integrity": "sha1-1+jn1+MJEHCSsF+NloiCTWM6QiY="
}
}
},
"repeat-element": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz",
@ -3685,6 +3873,24 @@
}
}
},
"script-ext-html-webpack-plugin": {
"version": "1.8.8",
"resolved": "https://registry.npmjs.org/script-ext-html-webpack-plugin/-/script-ext-html-webpack-plugin-1.8.8.tgz",
"integrity": "sha512-9mxSrvfX8on97tu4pUfLXQ9StKGxfHKSy3NXsYBi+4EpyhI4oUUhE3KEWUViDiTQHmY7u2ztLT5OfOjQRzmJaQ==",
"requires": {
"debug": "3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
@ -4085,6 +4291,26 @@
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
},
"style-ext-html-webpack-plugin": {
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/style-ext-html-webpack-plugin/-/style-ext-html-webpack-plugin-3.4.5.tgz",
"integrity": "sha512-w5h3OiFffi92bJ47UDxFPwsDSArDYl+gihRfyd39v8I8qqS6ohbPjiD0nAZCqDa5WFUWTZWwFAcQV5mwaJcIqg==",
"requires": {
"clean-css": "4.1.9",
"debug": "3.1.0",
"webpack-sources": "1.0.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"style-loader": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.19.0.tgz",
@ -4198,6 +4424,11 @@
"repeat-string": "1.6.1"
}
},
"toposort": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/toposort/-/toposort-1.0.6.tgz",
"integrity": "sha1-wxdI5V0hDv/AD9zcfW5o19e7nOw="
},
"tough-cookie": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz",
@ -4451,6 +4682,11 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"utila": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz",
"integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw="
},
"uuid": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",

View File

@ -17,10 +17,13 @@
"awesome-typescript-loader": "^3.3.0",
"css-loader": "^0.28.7",
"html-minifier": "^3.5.6",
"html-webpack-plugin": "^2.30.1",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"less-plugin-clean-css": "^1.5.1",
"script-ext-html-webpack-plugin": "^1.8.8",
"socket.io-client": "^2.0.4",
"style-ext-html-webpack-plugin": "^3.4.5",
"style-loader": "^0.19.0",
"typescript": "^2.6.1",
"uglify-js": "^3.1.8",

View File

@ -1,7 +1,9 @@
/*! webpack.config.js */
const webpack = require("webpack");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanCSSPlugin = require("less-plugin-clean-css");
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
module.exports = {
entry: "./client/dcwebui.js",
@ -38,8 +40,17 @@ module.exports = {
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
warnings: true
}
}),
new HtmlWebpackPlugin({
template: './client/index.htm',
filename: 'output.html',
//filename: './clientpack/index.htm',
minify: {},
}),
new ScriptExtHtmlWebpackPlugin({
inline: [ /\.*/ ]
})
]
};