leanweb 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/build.js +9 -1
- package/commands/dist.js +1 -2
- package/package.json +1 -1
package/commands/build.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import fse from 'fs-extra';
|
|
3
|
+
import { minify } from 'html-minifier';
|
|
3
4
|
import * as utils from './utils.js';
|
|
4
5
|
import * as parser from '../lib/lw-html-parser.js';
|
|
5
6
|
|
|
@@ -88,7 +89,14 @@ const require = createRequire(import.meta.url);
|
|
|
88
89
|
}
|
|
89
90
|
const styleString = cssString || '';
|
|
90
91
|
const htmlString = fs.readFileSync(htmlFilename, 'utf8');
|
|
91
|
-
const
|
|
92
|
+
const minifiedHtml = minify(htmlString, {
|
|
93
|
+
caseSensitive: true,
|
|
94
|
+
collapseWhitespace: true,
|
|
95
|
+
minifyCSS: true,
|
|
96
|
+
minifyJS: true,
|
|
97
|
+
removeComments: true,
|
|
98
|
+
});
|
|
99
|
+
const ast = parser.parse(minifiedHtml);
|
|
92
100
|
ast.css = styleString;
|
|
93
101
|
ast.componentFullName = project.name + '-' + cmp.replace(/\//g, '-');
|
|
94
102
|
ast.runtimeVersion = project.version;
|
package/commands/dist.js
CHANGED
|
@@ -2,7 +2,6 @@ import webpack from 'webpack';
|
|
|
2
2
|
import * as utils from './utils.js';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import fse from 'fs-extra';
|
|
5
|
-
// const minify = require('html-minifier').minify;
|
|
6
5
|
import { minify } from 'html-minifier';
|
|
7
6
|
import CleanCSS from 'clean-css';
|
|
8
7
|
|
|
@@ -49,7 +48,7 @@ if (args.length >= 3) {
|
|
|
49
48
|
collapseWhitespace: true,
|
|
50
49
|
minifyCSS: true,
|
|
51
50
|
minifyJS: true,
|
|
52
|
-
|
|
51
|
+
removeComments: true,
|
|
53
52
|
});
|
|
54
53
|
fs.writeFileSync(`./${utils.dirs.dist}/index.html`, minifiedIndexHtml);
|
|
55
54
|
|