Move minify script
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"js_dev_demo": "BUILD_DEMO=1 webpack --colors --progress -d --watch",
|
"js_dev_demo": "BUILD_DEMO=1 webpack --colors --progress -d --watch",
|
||||||
"js_prod": "BUILD_DEV=0 webpack --colors --progress -p -d",
|
"js_prod": "BUILD_DEV=0 webpack --colors --progress -p -d",
|
||||||
"js_demo": "BUILD_DEV=0 BUILD_DEMO=1 webpack --colors --progress -p -d",
|
"js_demo": "BUILD_DEV=0 BUILD_DEMO=1 webpack --colors --progress -p -d",
|
||||||
"frontend_html": "vulcanize --inline-css --inline-scripts --strip-comments src/home-assistant.html > build/frontend.vulcan.html && node scripts/minify.js",
|
"frontend_html": "vulcanize --inline-css --inline-scripts --strip-comments src/home-assistant.html > build/frontend.vulcan.html && node script/minify.js",
|
||||||
"frontend_prod": "npm run js_prod && bower install && npm run frontend_html",
|
"frontend_prod": "npm run js_prod && bower install && npm run frontend_html",
|
||||||
"frontend_demo": "npm run js_demo && bower install && npm run frontend_html",
|
"frontend_demo": "npm run js_demo && bower install && npm run frontend_html",
|
||||||
"setup_js_dev": "npm install && cd node_modules && rm -rf home-assistant-js && git clone https://github.com/balloob/home-assistant-js.git && cd home-assistant-js",
|
"setup_js_dev": "npm install && cd node_modules && rm -rf home-assistant-js && git clone https://github.com/balloob/home-assistant-js.git && cd home-assistant-js",
|
||||||
|
|||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
var minify = require('html-minifier');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
var html = fs.readFileSync('build/frontend.vulcan.html').toString();
|
||||||
|
|
||||||
|
var minifiedHtml = minify.minify(html, {
|
||||||
|
customAttrAssign: [/\$=/],
|
||||||
|
removeComments: true,
|
||||||
|
removeCommentsFromCDATA: true,
|
||||||
|
removeCDATASectionsFromCDATA: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
removeScriptTypeAttributes: true,
|
||||||
|
removeStyleLinkTypeAttributes: true,
|
||||||
|
minifyJS: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.writeFileSync('build/frontend.html', minifiedHtml);
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
var minify = require('html-minifier');
|
|
||||||
var fs = require('fs');
|
|
||||||
|
|
||||||
var html = fs.readFileSync('build/frontend.vulcan.html').toString();
|
|
||||||
|
|
||||||
var minifiedHtml = minify.minify(html, {
|
|
||||||
customAttrAssign: [/(\$|\?)=/],
|
|
||||||
"removeComments": true,
|
|
||||||
"removeCommentsFromCDATA": true,
|
|
||||||
"removeCDATASectionsFromCDATA": true,
|
|
||||||
"collapseWhitespace": true,
|
|
||||||
"removeScriptTypeAttributes": true,
|
|
||||||
"removeStyleLinkTypeAttributes": true,
|
|
||||||
"minifyJS": true,
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.writeFileSync('build/frontend.html', minifiedHtml);
|
|
||||||
Reference in New Issue
Block a user