htmlnano 1.1.1 → 2.0.2
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/CHANGELOG.md +31 -0
- package/README.md +8 -13
- package/docs/docs/050-modules.md +54 -2
- package/docs/package-lock.json +14644 -824
- package/docs/versioned_docs/version-2.0.0/010-introduction.md +22 -0
- package/docs/versioned_docs/version-2.0.0/020-usage.md +77 -0
- package/docs/versioned_docs/version-2.0.0/030-config.md +21 -0
- package/docs/versioned_docs/version-2.0.0/040-presets.md +75 -0
- package/docs/versioned_docs/version-2.0.0/050-modules.md +838 -0
- package/docs/versioned_docs/version-2.0.0/060-contribute.md +16 -0
- package/docs/versioned_sidebars/version-2.0.0-sidebars.json +8 -0
- package/docs/versions.json +1 -0
- package/lib/helpers.js +15 -2
- package/lib/htmlnano.js +85 -4
- package/lib/modules/collapseAttributeWhitespace.js +20 -20
- package/lib/modules/collapseBooleanAttributes.js +13 -19
- package/lib/modules/deduplicateAttributeValues.js +10 -16
- package/lib/modules/minifyCss.js +8 -8
- package/lib/modules/minifyJs.js +5 -8
- package/lib/modules/minifyJson.js +12 -24
- package/lib/modules/minifySvg.js +8 -4
- package/lib/modules/minifyUrls.js +29 -22
- package/lib/modules/normalizeAttributeValues.js +9 -15
- package/lib/modules/removeComments.js +17 -9
- package/lib/modules/removeEmptyAttributes.js +13 -16
- package/lib/modules/removeRedundantAttributes.js +19 -23
- package/lib/modules/removeUnusedCss.js +10 -10
- package/lib/presets/max.js +2 -0
- package/lib/presets/safe.js +2 -2
- package/package.json +49 -13
- package/uncss-fork.patch +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
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
|
+
## [2.0.2] - 2022-04-06
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- JSON-LD crash [#182]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## [2.0.1] - 2022-04-04
|
|
12
|
+
**This version contains a critical bug [#182].**
|
|
13
|
+
**Don't use it.**
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Speed improvements [#127]
|
|
17
|
+
- Fix `<img sizes>` [#180]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [2.0.0] - 2022-01-12
|
|
21
|
+
*The major version has to be released because of vulnerability in PostCSS (see [#165])*
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Support optional dependencies [#168] (`minifyUrl`, ` minifyJs`, `removeUnusedCss`, `minifyCss`). *This might be a breaking change for you*. Check the docs: https://github.com/posthtml/htmlnano/pull/168/files
|
|
25
|
+
- Disable `mergeScripts` & `mergeStyles` in the safe preset [#170].
|
|
26
|
+
|
|
5
27
|
|
|
6
28
|
## [1.1.1] - 2021-09-19
|
|
7
29
|
This version fixes fatal errors introduced in [1.1.0].
|
|
@@ -225,6 +247,9 @@ Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https:
|
|
|
225
247
|
- Remove attributes that contains only white spaces.
|
|
226
248
|
|
|
227
249
|
|
|
250
|
+
[2.0.2]: https://github.com/posthtml/htmlnano/compare/2.0.1...2.0.2
|
|
251
|
+
[2.0.1]: https://github.com/posthtml/htmlnano/compare/2.0.0...2.0.1
|
|
252
|
+
[2.0.0]: https://github.com/posthtml/htmlnano/compare/1.1.1...2.0.0
|
|
228
253
|
[1.1.1]: https://github.com/posthtml/htmlnano/compare/1.1.0...1.1.1
|
|
229
254
|
[1.1.0]: https://github.com/posthtml/htmlnano/compare/1.0.1...1.1.0
|
|
230
255
|
[1.0.1]: https://github.com/posthtml/htmlnano/compare/1.0.0...1.0.1
|
|
@@ -250,6 +275,11 @@ Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https:
|
|
|
250
275
|
[0.1.2]: https://github.com/posthtml/htmlnano/compare/0.1.1...0.1.2
|
|
251
276
|
[0.1.1]: https://github.com/posthtml/htmlnano/compare/0.1.0...0.1.1
|
|
252
277
|
|
|
278
|
+
[#182]: https://github.com/posthtml/htmlnano/issues/182
|
|
279
|
+
[#180]: https://github.com/posthtml/htmlnano/issues/180
|
|
280
|
+
[#170]: https://github.com/posthtml/htmlnano/issues/170
|
|
281
|
+
[#168]: https://github.com/posthtml/htmlnano/issues/168
|
|
282
|
+
[#165]: https://github.com/posthtml/htmlnano/issues/165
|
|
253
283
|
[#163]: https://github.com/posthtml/htmlnano/issues/163
|
|
254
284
|
[#161]: https://github.com/posthtml/htmlnano/issues/161
|
|
255
285
|
[#159]: https://github.com/posthtml/htmlnano/issues/159
|
|
@@ -261,6 +291,7 @@ Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https:
|
|
|
261
291
|
[#145]: https://github.com/posthtml/htmlnano/issues/145
|
|
262
292
|
[#135]: https://github.com/posthtml/htmlnano/issues/135
|
|
263
293
|
[#129]: https://github.com/posthtml/htmlnano/issues/129
|
|
294
|
+
[#127]: https://github.com/posthtml/htmlnano/issues/127
|
|
264
295
|
[#125]: https://github.com/posthtml/htmlnano/issues/125
|
|
265
296
|
[#122]: https://github.com/posthtml/htmlnano/issues/122
|
|
266
297
|
[#120]: https://github.com/posthtml/htmlnano/issues/120
|
package/README.md
CHANGED
|
@@ -4,22 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
Modular HTML minifier, built on top of the [PostHTML](https://github.com/posthtml/posthtml). Inspired by [cssnano](http://cssnano.co/).
|
|
6
6
|
|
|
7
|
-
To switch to the optional fork of uncss, apply `uncss-fork.patch`.
|
|
8
|
-
|
|
9
|
-
Reasons you may want to do this are: uncss uses outdated dependencies with security issues
|
|
10
|
-
|
|
11
|
-
Reasons you may want to avoid this are: long term support, stability
|
|
12
|
-
|
|
13
7
|
## [Benchmark](https://github.com/maltsev/html-minifiers-benchmark/blob/master/README.md)
|
|
14
|
-
[html-minifier-terser@
|
|
15
|
-
[htmlnano@1.
|
|
8
|
+
[html-minifier-terser@6.0.2]: https://www.npmjs.com/package/html-minifier-terser
|
|
9
|
+
[htmlnano@1.1.1]: https://www.npmjs.com/package/htmlnano
|
|
16
10
|
|
|
17
|
-
| Website | Source (KB) | [html-minifier-terser@
|
|
11
|
+
| Website | Source (KB) | [html-minifier-terser@6.0.2] | [htmlnano@1.1.1] |
|
|
18
12
|
|---------|------------:|----------------:|-----------:|
|
|
19
|
-
| [stackoverflow.blog](https://stackoverflow.blog/) |
|
|
20
|
-
| [github.com](https://github.com/) |
|
|
21
|
-
| [en.wikipedia.org](https://en.wikipedia.org/wiki/Main_Page) |
|
|
22
|
-
| [npmjs.com](https://www.npmjs.com/features) |
|
|
13
|
+
| [stackoverflow.blog](https://stackoverflow.blog/) | 90 | 82 | 76 |
|
|
14
|
+
| [github.com](https://github.com/) | 232 | 203 | 173 |
|
|
15
|
+
| [en.wikipedia.org](https://en.wikipedia.org/wiki/Main_Page) | 81 | 76 | 75 |
|
|
16
|
+
| [npmjs.com](https://www.npmjs.com/features) | 43 | 40 | 38 |
|
|
17
|
+
| [tc39.es](https://tc39.es/ecma262/) | 6001 | 5465 | 5459 |
|
|
23
18
|
| **Avg. minify rate** | 0% | **9%** | **13%** |
|
|
24
19
|
|
|
25
20
|
|
package/docs/docs/050-modules.md
CHANGED
|
@@ -203,6 +203,19 @@ or [PurgeCSS](https://github.com/FullHuman/purgecss).
|
|
|
203
203
|
|
|
204
204
|
#### With uncss
|
|
205
205
|
|
|
206
|
+
You have to install `uncss` in order to use this feature:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npm install --save-dev uncss
|
|
210
|
+
# if you prefer yarn
|
|
211
|
+
# yarn add --dev uncss
|
|
212
|
+
# if you prefer pnpm
|
|
213
|
+
# pnpm install --save-dev uncss
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
You can also use a mainted fork [@novaatwarren/uncss](https://www.npmjs.com/package/@novaatwarren/uncss) instead.
|
|
217
|
+
|
|
218
|
+
|
|
206
219
|
##### Options
|
|
207
220
|
See [the documentation of uncss](https://github.com/uncss/uncss) for all supported options.
|
|
208
221
|
|
|
@@ -225,6 +238,16 @@ The following uncss options are ignored if passed to the module:
|
|
|
225
238
|
|
|
226
239
|
Use PurgeCSS instead of uncss by adding `tool: 'purgeCSS'` to the options.
|
|
227
240
|
|
|
241
|
+
You have to install `purgecss` in order to use this feature:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npm install --save-dev purgecss
|
|
245
|
+
# if you prefer yarn
|
|
246
|
+
# yarn add --dev purgecss
|
|
247
|
+
# if you prefer pnpm
|
|
248
|
+
# pnpm install --save-dev purgecss
|
|
249
|
+
```
|
|
250
|
+
|
|
228
251
|
##### Options
|
|
229
252
|
|
|
230
253
|
See [the documentation of PurgeCSS](https://www.purgecss.com) for all supported options.
|
|
@@ -275,8 +298,18 @@ Optimized:
|
|
|
275
298
|
### minifyCss
|
|
276
299
|
Minifies CSS with [cssnano](http://cssnano.co/) inside `<style>` tags and `style` attributes.
|
|
277
300
|
|
|
301
|
+
You have to install `cssnano` and `postcss` in order to use this feature:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
npm install --save-dev cssnano postcss
|
|
305
|
+
# if you prefer yarn
|
|
306
|
+
# yarn add --dev cssnano postcss
|
|
307
|
+
# if you prefer pnpm
|
|
308
|
+
# pnpm install --save-dev cssnano postcss
|
|
309
|
+
```
|
|
310
|
+
|
|
278
311
|
#### Options
|
|
279
|
-
See [the documentation of cssnano](http://cssnano.co/optimisations/) for all supported optimizations.
|
|
312
|
+
See [the documentation of cssnano](http://cssnano.co/docs/optimisations/) for all supported optimizations.
|
|
280
313
|
By default CSS is minified with preset `default`, which shouldn't have any side-effects.
|
|
281
314
|
|
|
282
315
|
To use another preset or disabled some optimizations pass options to `minifyCss` module:
|
|
@@ -316,6 +349,16 @@ Minified:
|
|
|
316
349
|
### minifyJs
|
|
317
350
|
Minifies JS using [Terser](https://github.com/fabiosantoscode/terser) inside `<script>` tags.
|
|
318
351
|
|
|
352
|
+
You have to install `terser` in order to use this feature:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
npm install --save-dev terser
|
|
356
|
+
# if you prefer yarn
|
|
357
|
+
# yarn add --dev terser
|
|
358
|
+
# if you prefer pnpm
|
|
359
|
+
# pnpm install --save-dev terser
|
|
360
|
+
```
|
|
361
|
+
|
|
319
362
|
#### Options
|
|
320
363
|
See [the documentation of Terser](https://github.com/fabiosantoscode/terser#api-reference) for all supported options.
|
|
321
364
|
Terser options can be passed directly to the `minifyJs` module:
|
|
@@ -664,6 +707,16 @@ Processed:
|
|
|
664
707
|
### minifyUrls
|
|
665
708
|
Convert absolute URL to relative URL using [relateurl](https://www.npmjs.com/package/relateurl).
|
|
666
709
|
|
|
710
|
+
You have to install `relateurl`, `terser` and `srcset` in order to use this feature:
|
|
711
|
+
|
|
712
|
+
```bash
|
|
713
|
+
npm install --save-dev relateurl terser srcset
|
|
714
|
+
# if you prefer yarn
|
|
715
|
+
# yarn add --dev relateurl terser srcset
|
|
716
|
+
# if you prefer pnpm
|
|
717
|
+
# pnpm install --save-dev relateurl terser srcset
|
|
718
|
+
```
|
|
719
|
+
|
|
667
720
|
#### Options
|
|
668
721
|
|
|
669
722
|
The base URL to resolve against. Support `String` & `URL`.
|
|
@@ -783,4 +836,3 @@ Minified:
|
|
|
783
836
|
```html
|
|
784
837
|
<form method="get"></form>
|
|
785
838
|
```
|
|
786
|
-
|