Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maltsev committed Sep 19, 2021
1 parent 5fcd3a0 commit 4df008a
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 7 deletions.
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Collapse redundant white spaces in list-like attributes (`class`, `rel`, `ping`)
#### Example
Source:
```html
<div class=" content page "></div>
<a class=" content page " style=" display: block; " href=" https://example.com"></a>
```

Minified:
```html
<div class="content page"></div>
<a class="content page" style="display: block;" href="https://example.com"></a>
```


Expand Down Expand Up @@ -80,18 +80,68 @@ Minified:
#### Options
- `safe` – removes all HTML comments except the conditional comments and [`<!--noindex--><!--/noindex-->`](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
<div><!-- test --></div>
```

Minified:

```html
<div></div>
```

Source:

```js
{
removeComments: /<!--(\/)?noindex-->/
}
```

```html
<div><!--noindex-->this text will not be indexed<!--/noindex-->Lorem ipsum dolor sit amet<!--more-->Lorem ipsum dolor sit amet</div>
```

Minified:

```html
<div>this text will not be indexedLorem ipsum dolor sit amet<!--more-->Lorem ipsum dolor sit amet</div>
```

Source:

```js
{
removeComments: (comments) => {
if (comments.includes('noindex')) return true;
return false;
}
}
```

```html
<div><!--noindex-->this text will not be indexed<!--/noindex-->Lorem ipsum dolor sit amet<!--more-->Lorem ipsum dolor sit amet</div>
```

Minified:

```html
<div>this text will not be indexedLorem ipsum dolor sit amet<!--more-->Lorem ipsum dolor sit amet</div>
```


### removeEmptyAttributes
Removes empty [safe-to-remove](https://github.com/posthtml/htmlnano/blob/master/lib/modules/removeEmptyAttributes.es6) attributes.
Expand Down Expand Up @@ -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
<form method="GET"></form>
```

Minified:

```html
<form method="get"></form>
```

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version-1.0.1/tutorialSidebar": [
"version-1.1.0/tutorialSidebar": [
{
"type": "autogenerated",
"dirName": "."
Expand Down
2 changes: 1 addition & 1 deletion docs/versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[
"1.0.1"
"1.1.0"
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <maltsevkirill@gmail.com>",
Expand Down

0 comments on commit 4df008a

Please sign in to comment.