From 4df008af406acff8fa5d8c47de66f16641fb0a15 Mon Sep 17 00:00:00 2001 From: Kirill Maltsev Date: Sun, 19 Sep 2021 12:10:32 +0300 Subject: [PATCH] Release 1.1.0 --- CHANGELOG.md | 26 ++++++- .../010-introduction.md | 0 .../020-usage.md | 0 .../030-config.md | 0 .../040-presets.md | 0 .../050-modules.md | 75 ++++++++++++++++++- .../060-contribute.md | 0 ...ebars.json => version-1.1.0-sidebars.json} | 2 +- docs/versions.json | 2 +- package.json | 2 +- 10 files changed, 100 insertions(+), 7 deletions(-) rename docs/versioned_docs/{version-1.0.1 => version-1.1.0}/010-introduction.md (100%) rename docs/versioned_docs/{version-1.0.1 => version-1.1.0}/020-usage.md (100%) rename docs/versioned_docs/{version-1.0.1 => version-1.1.0}/030-config.md (100%) rename docs/versioned_docs/{version-1.0.1 => version-1.1.0}/040-presets.md (100%) rename docs/versioned_docs/{version-1.0.1 => version-1.1.0}/050-modules.md (90%) rename docs/versioned_docs/{version-1.0.1 => version-1.1.0}/060-contribute.md (100%) rename docs/versioned_sidebars/{version-1.0.1-sidebars.json => version-1.1.0-sidebars.json} (66%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff63c14..25542aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [1.1.0] - 2021-09-19 +### Added +- Collapse missing value default attribute in `removeRedundantAttributes` [#158]. +- New `normalizeAttributeValues` module to normalize casing of attribute values [#163]. +- Custom matcher for `removeComments` [#156]. + +### Changed +- Remove more empty attributes in `removeEmptyAttributes` [#161]. +- Enhance collapse whitespace in `collapseWhitespace` [#145]. +- `minifyJs` and `minifyUrls` enhancement [#159]. +- Enhance attribute collapse whitespace in `collapseAttributeWhitespace` [#157]. + + + ## [1.0.1] - 2021-09-11 ### Added - Support of [@novaatwarren/uncss](https://github.com/novaatwarren/uncss) fork [#154] @@ -205,6 +219,7 @@ Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https: - Remove attributes that contains only white spaces. +[1.1.0]: https://github.com/posthtml/htmlnano/compare/1.0.1...1.1.0 [1.0.1]: https://github.com/posthtml/htmlnano/compare/1.0.0...1.0.1 [1.0.0]: https://github.com/posthtml/htmlnano/compare/0.2.9...1.0.0 [0.2.9]: https://github.com/posthtml/htmlnano/compare/0.2.8...0.2.9 @@ -228,8 +243,15 @@ Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https: [0.1.2]: https://github.com/posthtml/htmlnano/compare/0.1.1...0.1.2 [0.1.1]: https://github.com/posthtml/htmlnano/compare/0.1.0...0.1.1 +[#163]: https://github.com/posthtml/htmlnano/issues/163 +[#161]: https://github.com/posthtml/htmlnano/issues/161 +[#159]: https://github.com/posthtml/htmlnano/issues/159 +[#158]: https://github.com/posthtml/htmlnano/issues/158 +[#157]: https://github.com/posthtml/htmlnano/issues/157 +[#156]: https://github.com/posthtml/htmlnano/issues/156 [#154]: https://github.com/posthtml/htmlnano/issues/154 [#153]: https://github.com/posthtml/htmlnano/issues/153 +[#145]: https://github.com/posthtml/htmlnano/issues/145 [#135]: https://github.com/posthtml/htmlnano/issues/135 [#129]: https://github.com/posthtml/htmlnano/issues/129 [#125]: https://github.com/posthtml/htmlnano/issues/125 @@ -243,10 +265,10 @@ Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https: [#112]: https://github.com/posthtml/htmlnano/issues/112 [#111]: https://github.com/posthtml/htmlnano/issues/111 [#110]: https://github.com/posthtml/htmlnano/issues/110 -[#107]: https://github.com/posthtml/htmlnano/issues/107 [#108]: https://github.com/posthtml/htmlnano/issues/108 -[#102]: https://github.com/posthtml/htmlnano/issues/102 +[#107]: https://github.com/posthtml/htmlnano/issues/107 [#104]: https://github.com/posthtml/htmlnano/issues/104 +[#102]: https://github.com/posthtml/htmlnano/issues/102 [#98]: https://github.com/posthtml/htmlnano/issues/98 [#95]: https://github.com/posthtml/htmlnano/issues/95 [#94]: https://github.com/posthtml/htmlnano/issues/94 diff --git a/docs/versioned_docs/version-1.0.1/010-introduction.md b/docs/versioned_docs/version-1.1.0/010-introduction.md similarity index 100% rename from docs/versioned_docs/version-1.0.1/010-introduction.md rename to docs/versioned_docs/version-1.1.0/010-introduction.md diff --git a/docs/versioned_docs/version-1.0.1/020-usage.md b/docs/versioned_docs/version-1.1.0/020-usage.md similarity index 100% rename from docs/versioned_docs/version-1.0.1/020-usage.md rename to docs/versioned_docs/version-1.1.0/020-usage.md diff --git a/docs/versioned_docs/version-1.0.1/030-config.md b/docs/versioned_docs/version-1.1.0/030-config.md similarity index 100% rename from docs/versioned_docs/version-1.0.1/030-config.md rename to docs/versioned_docs/version-1.1.0/030-config.md diff --git a/docs/versioned_docs/version-1.0.1/040-presets.md b/docs/versioned_docs/version-1.1.0/040-presets.md similarity index 100% rename from docs/versioned_docs/version-1.0.1/040-presets.md rename to docs/versioned_docs/version-1.1.0/040-presets.md diff --git a/docs/versioned_docs/version-1.0.1/050-modules.md b/docs/versioned_docs/version-1.1.0/050-modules.md similarity index 90% rename from docs/versioned_docs/version-1.0.1/050-modules.md rename to docs/versioned_docs/version-1.1.0/050-modules.md index e402b1b..d48d8cd 100644 --- a/docs/versioned_docs/version-1.0.1/050-modules.md +++ b/docs/versioned_docs/version-1.1.0/050-modules.md @@ -10,12 +10,12 @@ Collapse redundant white spaces in list-like attributes (`class`, `rel`, `ping`) #### Example Source: ```html -
+ ``` Minified: ```html -
+ ``` @@ -80,18 +80,68 @@ Minified: #### Options - `safe` – removes all HTML comments except the conditional comments and [``](https://yandex.com/support/webmaster/controlling-robot/html.xml) (default) - `all` — removes all HTML comments +- A `RegExp` — only HTML comments matching the given regexp will be removed. +- A `Function` that returns boolean — removes HTML comments that can make the given callback function returns truthy value. #### Example + Source: + +```js +{ + removeComments: 'all' +} +``` + ```html
``` Minified: + ```html
``` +Source: + +```js +{ + removeComments: // +} +``` + +```html +
this text will not be indexedLorem ipsum dolor sit ametLorem ipsum dolor sit amet
+``` + +Minified: + +```html +
this text will not be indexedLorem ipsum dolor sit ametLorem ipsum dolor sit amet
+``` + +Source: + +```js +{ + removeComments: (comments) => { + if (comments.includes('noindex')) return true; + return false; + } +} +``` + +```html +
this text will not be indexedLorem ipsum dolor sit ametLorem ipsum dolor sit amet
+``` + +Minified: + +```html +
this text will not be indexedLorem ipsum dolor sit ametLorem ipsum dolor sit amet
+``` + ### removeEmptyAttributes Removes empty [safe-to-remove](https://github.com/posthtml/htmlnano/blob/master/lib/modules/removeEmptyAttributes.es6) attributes. @@ -713,3 +763,24 @@ Due to [the limitation of PostHTML](https://github.com/posthtml/htmlnano/issues/ - `body` - `colgroup` - `tbody` + +### normalizeAttributeValues + +Normalize casing of attribute values. + +The module won't impact the plain-text size of the output. However it will improve the compression ratio of gzip/brotli used in HTTP compression. + +#### Example + +Source: + +```html +
+``` + +Minified: + +```html +
+``` + diff --git a/docs/versioned_docs/version-1.0.1/060-contribute.md b/docs/versioned_docs/version-1.1.0/060-contribute.md similarity index 100% rename from docs/versioned_docs/version-1.0.1/060-contribute.md rename to docs/versioned_docs/version-1.1.0/060-contribute.md diff --git a/docs/versioned_sidebars/version-1.0.1-sidebars.json b/docs/versioned_sidebars/version-1.1.0-sidebars.json similarity index 66% rename from docs/versioned_sidebars/version-1.0.1-sidebars.json rename to docs/versioned_sidebars/version-1.1.0-sidebars.json index f04a3d5..476ebb0 100644 --- a/docs/versioned_sidebars/version-1.0.1-sidebars.json +++ b/docs/versioned_sidebars/version-1.1.0-sidebars.json @@ -1,5 +1,5 @@ { - "version-1.0.1/tutorialSidebar": [ + "version-1.1.0/tutorialSidebar": [ { "type": "autogenerated", "dirName": "." diff --git a/docs/versions.json b/docs/versions.json index 4b781f5..c5854aa 100644 --- a/docs/versions.json +++ b/docs/versions.json @@ -1,3 +1,3 @@ [ - "1.0.1" + "1.1.0" ] diff --git a/package.json b/package.json index b4efde7..6d769ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "htmlnano", - "version": "1.0.1", + "version": "1.1.0", "description": "Modular HTML minifier, built on top of the PostHTML", "main": "index.js", "author": "Kirill Maltsev ",