Move minify script

This commit is contained in:
Paulus Schoutsen 2015-10-25 18:59:25 -07:00
parent c51c176ed6
commit ac34b5fc26
3 changed files with 18 additions and 18 deletions

View File

@ -11,7 +11,7 @@
"js_dev_demo": "BUILD_DEMO=1 webpack --colors --progress -d --watch",
"js_prod": "BUILD_DEV=0 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_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",

17
script/minify.js Executable file
View File

@ -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);

View File

@ -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);