minify_html 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +76 -23
- data/lib/linux-ruby2.5 +0 -0
- data/lib/linux-ruby2.6 +0 -0
- data/lib/linux-ruby2.7 +0 -0
- data/lib/macos-ruby2.5 +0 -0
- data/lib/macos-ruby2.6 +0 -0
- data/lib/macos-ruby2.7 +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697e2591534633035e8aab9afb878292c2e9caad26d82bbdeadb31a03452f95d
|
4
|
+
data.tar.gz: 75a99b0c3ff75e820f7b88b7ba9ff5337baea5c6fc1ecccb61fd688f2246db62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5c91b1af108805b305dfe34c802efe1c9d8ded33baf3bfe4cbcf986f09d374f39cab04128c2ca01312ccff0db59016777273a0dffc8f1e7d652d70a1cfe4c7d
|
7
|
+
data.tar.gz: 3d09e35ac095b2d3c8f344a193782d80636e3bf238ed50e81a2c54bbd5fdf28d211338525ba3dcf9aa7b9a54fe4332f17beeb3475a597e8b8ad0b6836fa764dd
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
<h1>
|
2
2
|
minify-html
|
3
3
|
<img width="24" src="https://wilsonl.in/minify-html/icon/cli.png">
|
4
|
+
<img width="24" src="https://wilsonl.in/minify-html/icon/deno.png">
|
4
5
|
<img width="24" src="https://wilsonl.in/minify-html/icon/java.png">
|
5
6
|
<img width="24" src="https://wilsonl.in/minify-html/icon/nodejs.png">
|
6
7
|
<img width="24" src="https://wilsonl.in/minify-html/icon/python.png">
|
7
8
|
<img width="24" src="https://wilsonl.in/minify-html/icon/ruby.png">
|
8
9
|
<img width="24" src="https://wilsonl.in/minify-html/icon/rust.png">
|
10
|
+
<img width="24" src="https://wilsonl.in/minify-html/icon/wasm.png">
|
9
11
|
</h1>
|
10
12
|
|
11
13
|
A Rust HTML minifier meticulously optimised for speed and effectiveness, with bindings for other languages.
|
@@ -13,13 +15,15 @@ A Rust HTML minifier meticulously optimised for speed and effectiveness, with bi
|
|
13
15
|
- Advanced minification strategy beats other minifiers while being much faster.
|
14
16
|
- Uses SIMD searching, direct tries, and lookup tables.
|
15
17
|
- Handles [invalid HTML](./notes/Parsing.md), with extensive testing and [fuzzing](./fuzz).
|
16
|
-
-
|
18
|
+
- Uses [minify-js](https://github.com/wilsonzlin/minify-js) for super fast JS minification.
|
19
|
+
|
20
|
+
View the [changelog](./CHANGELOG.md) to see the latest updates.
|
17
21
|
|
18
22
|
## Performance
|
19
23
|
|
20
|
-
Comparison with [html-
|
24
|
+
Comparison with [html-minifier](https://github.com/kangax/html-minifier) and [minimize](https://github.com/Swaagie/minimize), run on the top web pages. [See the breakdown here.](./bench)
|
21
25
|
|
22
|
-
<img width="400" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.
|
26
|
+
<img width="400" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.9.0/core/average-speeds.png"><img width="400" alt="Chart showing compression of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.9.0/core/average-sizes.png">
|
23
27
|
|
24
28
|
The [onepass](https://github.com/wilsonzlin/minify-html/tree/master/rust/onepass) variant is even more optimised for speed. See its [README](https://github.com/wilsonzlin/minify-html/tree/master/rust/onepass) for more details.
|
25
29
|
|
@@ -32,11 +36,11 @@ Precompiled binaries are available for Linux, macOS, and Windows.
|
|
32
36
|
|
33
37
|
### Get
|
34
38
|
|
35
|
-
[Linux x64](https://wilsonl.in/minify-html/bin/0.
|
36
|
-
[Linux ARM64](https://wilsonl.in/minify-html/bin/0.
|
37
|
-
[macOS x64](https://wilsonl.in/minify-html/bin/0.
|
38
|
-
[macOS ARM64](https://wilsonl.in/minify-html/bin/0.
|
39
|
-
[Windows x64](https://wilsonl.in/minify-html/bin/0.
|
39
|
+
[Linux x64](https://wilsonl.in/minify-html/bin/0.9.0-linux-x86_64) |
|
40
|
+
[Linux ARM64](https://wilsonl.in/minify-html/bin/0.9.0-linux-arm64) |
|
41
|
+
[macOS x64](https://wilsonl.in/minify-html/bin/0.9.0-macos-x86_64) |
|
42
|
+
[macOS ARM64](https://wilsonl.in/minify-html/bin/0.9.0-macos-arm64) |
|
43
|
+
[Windows x64](https://wilsonl.in/minify-html/bin/0.9.0-windows-x86_64.exe)
|
40
44
|
|
41
45
|
### Use
|
42
46
|
|
@@ -55,24 +59,44 @@ minify-html --output /path/to/output.min.html --keep-closing-tags --minify-css /
|
|
55
59
|
|
56
60
|
```toml
|
57
61
|
[dependencies]
|
58
|
-
minify-html = { version = "0.
|
62
|
+
minify-html = { version = "0.9.0" }
|
59
63
|
```
|
60
64
|
|
61
|
-
|
65
|
+
### Use
|
66
|
+
|
67
|
+
Check out the [docs](https://docs.rs/minify-html) for API and usage examples.
|
68
|
+
|
69
|
+
</details>
|
70
|
+
|
71
|
+
<details>
|
72
|
+
<summary><img width="24" src="https://wilsonl.in/minify-html/icon/deno.png"> <strong>Deno</strong></summary>
|
62
73
|
|
63
|
-
|
74
|
+
- Package: https://wilsonl.in/minify-html/deno/0.9.0/index.js
|
75
|
+
- Binding: [WASM](https://webassembly.org/)
|
76
|
+
- Platforms: All
|
64
77
|
|
65
78
|
### Use
|
66
79
|
|
67
|
-
|
80
|
+
```ts
|
81
|
+
import init, {minify} from "https://wilsonl.in/minify-html/deno/0.9.0/index.js";
|
82
|
+
|
83
|
+
const encoder = new TextEncoder();
|
84
|
+
const decoder = new TextDecoder();
|
85
|
+
|
86
|
+
await init();
|
87
|
+
|
88
|
+
const minified = decoder.decode(minify(encoder.encode("<p> Hello, world! </p>"), { keep_spaces_between_attributes: true, keep_comments: true }));
|
89
|
+
```
|
90
|
+
|
91
|
+
All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html) are available as snake_case properties on the object provided as the second argument; if any are not set, they default to `false`.
|
68
92
|
|
69
93
|
</details>
|
70
94
|
|
71
95
|
<details>
|
72
96
|
<summary><img width="24" src="https://wilsonl.in/minify-html/icon/nodejs.png"> <strong>Node.js</strong></summary>
|
73
97
|
|
74
|
-
- Package: [@minify-html/
|
75
|
-
- Binding: [
|
98
|
+
- Package: [@minify-html/node](https://www.npmjs.com/package/@minify-html/node)
|
99
|
+
- Binding: [Neon](https://github.com/neon-bindings/neon)
|
76
100
|
- Platforms: Linux (ARM64 and x64), macOS (ARM64 and x64), Windows (x64); Node.js 8.6.0 and higher
|
77
101
|
|
78
102
|
### Get
|
@@ -80,13 +104,13 @@ Check out the [docs](https://docs.rs/minify-html) for API and usage examples.
|
|
80
104
|
Using npm:
|
81
105
|
|
82
106
|
```bash
|
83
|
-
npm i @minify-html/
|
107
|
+
npm i @minify-html/node
|
84
108
|
```
|
85
109
|
|
86
110
|
Using Yarn:
|
87
111
|
|
88
112
|
```bash
|
89
|
-
yarn add @minify-html/
|
113
|
+
yarn add @minify-html/node
|
90
114
|
```
|
91
115
|
|
92
116
|
### Use
|
@@ -94,14 +118,13 @@ yarn add @minify-html/js
|
|
94
118
|
TypeScript definitions are available.
|
95
119
|
|
96
120
|
```ts
|
97
|
-
import * as minifyHtml from "@minify-html/
|
98
|
-
// Or `const minifyHtml = require("@minify-html/
|
121
|
+
import * as minifyHtml from "@minify-html/node";
|
122
|
+
// Or `const minifyHtml = require("@minify-html/node")` if not using TS/ESM.
|
99
123
|
|
100
|
-
const
|
101
|
-
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
|
124
|
+
const minified = minifyHtml.minify("<p> Hello, world! </p>", { keep_spaces_between_attributes: true, keep_comments: true });
|
102
125
|
```
|
103
126
|
|
104
|
-
All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html) are available as snake_case properties on the object provided
|
127
|
+
All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html) are available as snake_case properties on the object provided as the second argument; if any are not set, they default to `false`.
|
105
128
|
|
106
129
|
</details>
|
107
130
|
|
@@ -120,7 +143,7 @@ Add as a Maven dependency:
|
|
120
143
|
<dependency>
|
121
144
|
<groupId>in.wilsonl.minifyhtml</groupId>
|
122
145
|
<artifactId>minify-html</artifactId>
|
123
|
-
<version>0.
|
146
|
+
<version>0.9.0</version>
|
124
147
|
</dependency>
|
125
148
|
```
|
126
149
|
|
@@ -188,9 +211,39 @@ All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.htm
|
|
188
211
|
|
189
212
|
</details>
|
190
213
|
|
214
|
+
<details>
|
215
|
+
<summary><img width="24" src="https://wilsonl.in/minify-html/icon/wasm.png"> <strong>WASM</strong></summary>
|
216
|
+
|
217
|
+
- Package: [@minify-html/wasm](https://npmjs.org/package/@minify-html/wasm)
|
218
|
+
- Binding: [WASM](https://webassembly.org/)
|
219
|
+
- Platforms: All
|
220
|
+
|
221
|
+
A bundler may be required to use the WebAssembly module, see [this](https://rustwasm.github.io/wasm-bindgen/reference/deployment.html#bundlers) for more details.
|
222
|
+
|
223
|
+
### Use
|
224
|
+
|
225
|
+
```ts
|
226
|
+
import init, {minify} from "@minify-html/wasm";
|
227
|
+
|
228
|
+
const encoder = new TextEncoder();
|
229
|
+
const decoder = new TextDecoder();
|
230
|
+
|
231
|
+
await init();
|
232
|
+
|
233
|
+
const minified = decoder.decode(minify(encoder.encode("<p> Hello, world! </p>"), { keep_spaces_between_attributes: true, keep_comments: true }));
|
234
|
+
```
|
235
|
+
|
236
|
+
All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.html) are available as snake_case properties on the object provided as the second argument; if any are not set, they default to `false`.
|
237
|
+
|
238
|
+
</details>
|
239
|
+
|
191
240
|
## Minification
|
192
241
|
|
193
|
-
Note that some of the minification done can result in HTML that will not pass validation, but remain interpreted and rendered correctly by the browser; essentially, the laxness of the browser is taken advantage of for better minification.
|
242
|
+
Note that some of the minification done can result in HTML that will not pass validation, but remain interpreted and rendered correctly by the browser; essentially, the laxness of the browser is taken advantage of for better minification. To prevent this, refer to these configuration options:
|
243
|
+
|
244
|
+
- `do_not_minify_doctype`
|
245
|
+
- `ensure_spec_compliant_unquoted_attribute_values`
|
246
|
+
- `keep_spaces_between_attributes`
|
194
247
|
|
195
248
|
### Whitespace
|
196
249
|
|
data/lib/linux-ruby2.5
CHANGED
Binary file
|
data/lib/linux-ruby2.6
CHANGED
Binary file
|
data/lib/linux-ruby2.7
CHANGED
Binary file
|
data/lib/macos-ruby2.5
CHANGED
Binary file
|
data/lib/macos-ruby2.6
CHANGED
Binary file
|
data/lib/macos-ruby2.7
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minify_html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wilson Lin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fiddle
|