htmlnano 0.2.4 → 0.2.8

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/test.js CHANGED
@@ -1,14 +1,37 @@
1
- const htmlnano = require('./index');
2
- const fs = require('fs');
3
- const safePreset = require('./lib/presets/safe').default;
1
+ const htmlnano = require('.');
2
+ const options = {
3
+ // minifySvg: false,
4
+ // minifyJs: false,
5
+ };
6
+ // // posthtml, posthtml-render, and posthtml-parse options
7
+ // const postHtmlOptions = {
8
+ // sync: true, // https://github.com/posthtml/posthtml#usage
9
+ // lowerCaseTags: true, // https://github.com/posthtml/posthtml-parser#options
10
+ // quoteAllAttributes: false, // https://github.com/posthtml/posthtml-render#options
11
+ // };
4
12
 
5
- const options = {};
6
-
7
- const html = fs.readFileSync('./test.html', 'utf8');
13
+ const html = `
14
+ <!doctype html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="utf-8">
18
+ <title></title>
19
+ <script class="fob">alert(1)</script>
20
+ <script>alert(2)</script>
21
+ </head>
22
+ <body>
23
+ <script>alert(3)</script>
24
+ <script>alert(4)</script>
25
+ </body>
26
+ </html>
27
+ `;
8
28
 
9
29
  htmlnano
30
+ // "preset" arg might be skipped (see "Presets" section below for more info)
31
+ // "postHtmlOptions" arg might be skipped
10
32
  .process(html, options)
11
33
  .then(function (result) {
34
+ // result.html is minified
12
35
  console.log(result.html);
13
36
  })
14
37
  .catch(function (err) {
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _objectAssign = require('object-assign');
8
-
9
- var _objectAssign2 = _interopRequireDefault(_objectAssign);
10
-
11
- var _safe = require('./safe');
12
-
13
- var _safe2 = _interopRequireDefault(_safe);
14
-
15
- function _interopRequireDefault(obj) {
16
- return obj && obj.__esModule ? obj : { default: obj };
17
- }
18
-
19
- /**
20
- *
21
- */
22
- exports.default = (0, _objectAssign2.default)({}, _safe2.default, {
23
- collapseWhitespace: 'all',
24
- removeComments: 'all',
25
- removeRedundantAttributes: true
26
- });