htmlnano 0.2.2 → 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/.eslintignore +1 -0
- package/CHANGELOG.md +8 -1
- package/README.md +24 -4
- package/lib/presets/max.js +2 -1
- package/lib/presets/safe.js +3 -1
- package/package.json +6 -6
- package/test.js +20 -0
package/.eslintignore
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,17 @@ All notable changes to this project will be documented in this file.
|
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## [0.2.3] - 2019-02-14
|
|
7
|
+
## Fixed
|
|
8
|
+
- Keep `<g>` in SVG by default [#71].
|
|
9
|
+
|
|
10
|
+
|
|
6
11
|
## [0.2.2] - 2019-01-03
|
|
7
12
|
## Added
|
|
8
13
|
- `removeUnusedCss` module [#36].
|
|
9
14
|
|
|
10
15
|
## Fixed
|
|
11
|
-
- Bug when tag === false [#66].
|
|
16
|
+
- Bug when `tag === false` [#66].
|
|
12
17
|
- Add `crossorigin` to boolean attributes [#67].
|
|
13
18
|
|
|
14
19
|
|
|
@@ -111,6 +116,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
111
116
|
|
|
112
117
|
|
|
113
118
|
|
|
119
|
+
[0.2.3]: https://github.com/posthtml/htmlnano/compare/0.2.1...0.2.3
|
|
114
120
|
[0.2.2]: https://github.com/posthtml/htmlnano/compare/0.2.1...0.2.2
|
|
115
121
|
[0.2.1]: https://github.com/posthtml/htmlnano/compare/0.2.0...0.2.1
|
|
116
122
|
[0.2.0]: https://github.com/posthtml/htmlnano/compare/0.1.10...0.2.0
|
|
@@ -126,6 +132,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
126
132
|
[0.1.1]: https://github.com/posthtml/htmlnano/compare/0.1.0...0.1.1
|
|
127
133
|
|
|
128
134
|
|
|
135
|
+
[#71]: https://github.com/posthtml/htmlnano/issues/67
|
|
129
136
|
[#67]: https://github.com/posthtml/htmlnano/issues/67
|
|
130
137
|
[#66]: https://github.com/posthtml/htmlnano/issues/66
|
|
131
138
|
[#65]: https://github.com/posthtml/htmlnano/issues/65
|
package/README.md
CHANGED
|
@@ -361,10 +361,20 @@ Minified:
|
|
|
361
361
|
|
|
362
362
|
|
|
363
363
|
### minifyJs
|
|
364
|
-
Minifies JS
|
|
364
|
+
Minifies JS using [Terser](https://github.com/fabiosantoscode/terser) inside `<script>` tags.
|
|
365
365
|
|
|
366
366
|
##### Options
|
|
367
|
-
See [the
|
|
367
|
+
See [the documentation of Terser](https://github.com/fabiosantoscode/terser#api-reference) for all supported options.
|
|
368
|
+
Terser options can be passed directly to the `minifyJs` module:
|
|
369
|
+
```js
|
|
370
|
+
htmlnano.process(html, {
|
|
371
|
+
minifyJs: {
|
|
372
|
+
output: { quote_style: 1 },
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
|
|
368
378
|
|
|
369
379
|
##### Example
|
|
370
380
|
Source:
|
|
@@ -407,10 +417,20 @@ Minified:
|
|
|
407
417
|
|
|
408
418
|
|
|
409
419
|
### minifySvg
|
|
410
|
-
Minifies SVG inside `<svg>` tags
|
|
420
|
+
Minifies SVG inside `<svg>` tags using [SVGO](https://github.com/svg/svgo/).
|
|
411
421
|
|
|
412
422
|
##### Options
|
|
413
|
-
See [the documentation of SVGO](https://github.com/svg/svgo/blob/master/README.md)
|
|
423
|
+
See [the documentation of SVGO](https://github.com/svg/svgo/blob/master/README.md) for all supported options.
|
|
424
|
+
SVGO options can be passed directly to the `minifySvg` module:
|
|
425
|
+
```js
|
|
426
|
+
htmlnano.process(html, {
|
|
427
|
+
minifySvg: {
|
|
428
|
+
plugins: [
|
|
429
|
+
{ collapseGroups: false },
|
|
430
|
+
],
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
```
|
|
414
434
|
|
|
415
435
|
##### Example
|
|
416
436
|
Source:
|
package/lib/presets/max.js
CHANGED
package/lib/presets/safe.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "htmlnano",
|
|
3
|
-
"version": "0.2.
|
|
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>",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"cssnano": "^4.1.
|
|
35
|
+
"cssnano": "^4.1.9",
|
|
36
36
|
"normalize-html-whitespace": "^0.2.0",
|
|
37
37
|
"object-assign": "^4.0.1",
|
|
38
38
|
"posthtml": "^0.11.3",
|
|
39
39
|
"posthtml-render": "^1.1.4",
|
|
40
40
|
"svgo": "^1.0.5",
|
|
41
|
-
"terser": "^3.
|
|
41
|
+
"terser": "^3.16.1",
|
|
42
42
|
"uncss": "^0.16.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"babel-core": "^6.26.3",
|
|
47
47
|
"babel-eslint": "^10.0.0",
|
|
48
48
|
"babel-preset-env": "^1.7.0",
|
|
49
|
-
"eslint": "^5.
|
|
50
|
-
"expect": "^
|
|
49
|
+
"eslint": "^5.13.0",
|
|
50
|
+
"expect": "^24.0.0",
|
|
51
51
|
"mocha": "^5.2.0",
|
|
52
|
-
"release-it": "^
|
|
52
|
+
"release-it": "^10.0.0",
|
|
53
53
|
"rimraf": "^2.6.3"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
package/test.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const htmlnano = require('./index');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const safePreset = require('./lib/presets/safe').default;
|
|
4
|
+
|
|
5
|
+
const options = {
|
|
6
|
+
minifySvg: safePreset.minifySvg,
|
|
7
|
+
};
|
|
8
|
+
|
|
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
|
+
});
|