htmlnano 0.1.10 → 0.2.3

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/package.json CHANGED
@@ -1,17 +1,23 @@
1
1
  {
2
2
  "name": "htmlnano",
3
- "version": "0.1.10",
3
+ "version": "0.2.3",
4
4
  "description": "Modular HTML minifier, built on top of the PostHTML",
5
5
  "main": "index.js",
6
6
  "author": "Kirill Maltsev <maltsevkirill@gmail.com>",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
9
  "compile": "rimraf lib/*.js && rimraf lib/modules/*.js && babel -d lib/ lib/",
10
- "lint": "eslint *.js lib/*.es6 lib/modules/*.es6 test/",
10
+ "lint": "eslint *.js lib/*.es6 lib/modules/*.es6 lib/presets/*.es6 test/",
11
11
  "pretest": "npm run lint && npm run compile",
12
12
  "test": ":",
13
13
  "posttest": "mocha --require babel-core/register --recursive --check-leaks --globals addresses",
14
- "prepare": "npm run compile"
14
+ "prepare": "npm run compile",
15
+ "release:patch": "release-it patch -n"
16
+ },
17
+ "release-it": {
18
+ "scripts": {
19
+ "beforeStart": "npm test"
20
+ }
15
21
  },
16
22
  "keywords": [
17
23
  "posthtml",
@@ -22,26 +28,29 @@
22
28
  ],
23
29
  "babel": {
24
30
  "presets": [
25
- "es2015"
31
+ "env"
26
32
  ]
27
33
  },
28
34
  "dependencies": {
29
- "cssnano": "^3.4.0",
35
+ "cssnano": "^4.1.9",
36
+ "normalize-html-whitespace": "^0.2.0",
30
37
  "object-assign": "^4.0.1",
31
38
  "posthtml": "^0.11.3",
32
39
  "posthtml-render": "^1.1.4",
33
40
  "svgo": "^1.0.5",
34
- "terser": "^3.8.1"
41
+ "terser": "^3.16.1",
42
+ "uncss": "^0.16.2"
35
43
  },
36
44
  "devDependencies": {
37
45
  "babel-cli": "^6.26.0",
38
46
  "babel-core": "^6.26.3",
39
- "babel-eslint": "^8.2.6",
40
- "babel-preset-es2015": "^6.1.18",
41
- "eslint": "^5.2.0",
42
- "expect": "^23.4.0",
47
+ "babel-eslint": "^10.0.0",
48
+ "babel-preset-env": "^1.7.0",
49
+ "eslint": "^5.13.0",
50
+ "expect": "^24.0.0",
43
51
  "mocha": "^5.2.0",
44
- "rimraf": "^2.6.2"
52
+ "release-it": "^10.0.0",
53
+ "rimraf": "^2.6.3"
45
54
  },
46
55
  "repository": {
47
56
  "type": "git",
package/test.js CHANGED
@@ -1,17 +1,20 @@
1
- // var fs = require('fs');
2
- // var htmlnano = require('./index');
3
- // var options = {
4
- // // removeEmptyAttributes: false, // Disable the module "removeEmptyAttributes"
5
- // // collapseWhitespace: 'conservative' // Pass options to the module "collapseWhitespace"
6
- // };
1
+ const htmlnano = require('./index');
2
+ const fs = require('fs');
3
+ const safePreset = require('./lib/presets/safe').default;
7
4
 
8
- // // var html = fs.readFileSync('./test.html', 'utf8');
9
- // var html = `
10
- // <script src="../ts/options.ts" />
11
- // `;
5
+ const options = {
6
+ minifySvg: safePreset.minifySvg,
7
+ };
12
8
 
13
- // htmlnano.process(html, options).then(function (result) {
14
- // // console.log(result.html);
15
- // }).catch(function (err) {
16
- // // console.error(err);
17
- // });
9
+ console.log(options);
10
+
11
+ const svg = fs.readFileSync('./orig.html', 'utf8');
12
+
13
+ htmlnano
14
+ .process(svg, options, {})
15
+ .then(function (result) {
16
+ console.log(result.html);
17
+ })
18
+ .catch(function (err) {
19
+ console.error(err);
20
+ });
package/test.html DELETED
@@ -1,14 +0,0 @@
1
- <html lang="en">
2
-
3
- <head>
4
- <script src="./app.js"></script>
5
- </head>
6
-
7
- <body>
8
- <script>
9
- console.log('hello');
10
- const p = new Point(10, 10);
11
- </script>
12
- </body>
13
-
14
- </html>