minify_html 0.8.1 → 0.9.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.
- checksums.yaml +4 -4
- data/README.md +82 -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: 87157156d886bb5441dba95827ac3f02db44b0a1c8c9ab1b182b2acabd64696a
|
4
|
+
data.tar.gz: 905ed3bc2db56eac0b22d855086477a26f1d854622c088162f41652936d9c806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3772603fbb7e39849da79324ffdb343a40e759927b0bbd34f53a27dab7b1c72cd8d519f9930a8ccdeb4ba7d8b265474ae2e58daac10325dd413b8434c1d2f8a4
|
7
|
+
data.tar.gz: '0487f08956662c167d102bc2bc953a086875596436e3069dbbeecacf10be3c3b0137df422eb25a127b8b42ce2763fddba715971bbcc2c2da4960a914764d3532'
|
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.2/core/average-speeds.png"><img width="400" alt="Chart showing compression of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.9.2/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.2-linux-x86_64) |
|
40
|
+
[Linux ARM64](https://wilsonl.in/minify-html/bin/0.9.2-linux-arm64) |
|
41
|
+
[macOS x64](https://wilsonl.in/minify-html/bin/0.9.2-macos-x86_64) |
|
42
|
+
[macOS ARM64](https://wilsonl.in/minify-html/bin/0.9.2-macos-arm64) |
|
43
|
+
[Windows x64](https://wilsonl.in/minify-html/bin/0.9.2-windows-x86_64.exe)
|
40
44
|
|
41
45
|
### Use
|
42
46
|
|
@@ -46,6 +50,12 @@ Use the `--help` argument for more details.
|
|
46
50
|
minify-html --output /path/to/output.min.html --keep-closing-tags --minify-css /path/to/src.html
|
47
51
|
```
|
48
52
|
|
53
|
+
To quickly parallel process a batch of files in place:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
minify-html --keep-closing-tags --minify-css /path/to/**/*.html
|
57
|
+
```
|
58
|
+
|
49
59
|
</details>
|
50
60
|
|
51
61
|
<details>
|
@@ -55,24 +65,44 @@ minify-html --output /path/to/output.min.html --keep-closing-tags --minify-css /
|
|
55
65
|
|
56
66
|
```toml
|
57
67
|
[dependencies]
|
58
|
-
minify-html =
|
68
|
+
minify-html = "0.9.2"
|
59
69
|
```
|
60
70
|
|
61
|
-
|
71
|
+
### Use
|
72
|
+
|
73
|
+
Check out the [docs](https://docs.rs/minify-html) for API and usage examples.
|
74
|
+
|
75
|
+
</details>
|
76
|
+
|
77
|
+
<details>
|
78
|
+
<summary><img width="24" src="https://wilsonl.in/minify-html/icon/deno.png"> <strong>Deno</strong></summary>
|
62
79
|
|
63
|
-
|
80
|
+
- Package: https://wilsonl.in/minify-html/deno/0.9.2/index.js
|
81
|
+
- Binding: [WASM](https://webassembly.org/)
|
82
|
+
- Platforms: All
|
64
83
|
|
65
84
|
### Use
|
66
85
|
|
67
|
-
|
86
|
+
```ts
|
87
|
+
import init, {minify} from "https://wilsonl.in/minify-html/deno/0.9.2/index.js";
|
88
|
+
|
89
|
+
const encoder = new TextEncoder();
|
90
|
+
const decoder = new TextDecoder();
|
91
|
+
|
92
|
+
await init();
|
93
|
+
|
94
|
+
const minified = decoder.decode(minify(encoder.encode("<p> Hello, world! </p>"), { keep_spaces_between_attributes: true, keep_comments: true }));
|
95
|
+
```
|
96
|
+
|
97
|
+
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
98
|
|
69
99
|
</details>
|
70
100
|
|
71
101
|
<details>
|
72
102
|
<summary><img width="24" src="https://wilsonl.in/minify-html/icon/nodejs.png"> <strong>Node.js</strong></summary>
|
73
103
|
|
74
|
-
- Package: [@minify-html/
|
75
|
-
- Binding: [
|
104
|
+
- Package: [@minify-html/node](https://www.npmjs.com/package/@minify-html/node)
|
105
|
+
- Binding: [Neon](https://github.com/neon-bindings/neon)
|
76
106
|
- Platforms: Linux (ARM64 and x64), macOS (ARM64 and x64), Windows (x64); Node.js 8.6.0 and higher
|
77
107
|
|
78
108
|
### Get
|
@@ -80,13 +110,13 @@ Check out the [docs](https://docs.rs/minify-html) for API and usage examples.
|
|
80
110
|
Using npm:
|
81
111
|
|
82
112
|
```bash
|
83
|
-
npm i @minify-html/
|
113
|
+
npm i @minify-html/node
|
84
114
|
```
|
85
115
|
|
86
116
|
Using Yarn:
|
87
117
|
|
88
118
|
```bash
|
89
|
-
yarn add @minify-html/
|
119
|
+
yarn add @minify-html/node
|
90
120
|
```
|
91
121
|
|
92
122
|
### Use
|
@@ -94,14 +124,13 @@ yarn add @minify-html/js
|
|
94
124
|
TypeScript definitions are available.
|
95
125
|
|
96
126
|
```ts
|
97
|
-
import * as minifyHtml from "@minify-html/
|
98
|
-
// Or `const minifyHtml = require("@minify-html/
|
127
|
+
import * as minifyHtml from "@minify-html/node";
|
128
|
+
// Or `const minifyHtml = require("@minify-html/node")` if not using TS/ESM.
|
99
129
|
|
100
|
-
const
|
101
|
-
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
|
130
|
+
const minified = minifyHtml.minify("<p> Hello, world! </p>", { keep_spaces_between_attributes: true, keep_comments: true });
|
102
131
|
```
|
103
132
|
|
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
|
133
|
+
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
134
|
|
106
135
|
</details>
|
107
136
|
|
@@ -120,7 +149,7 @@ Add as a Maven dependency:
|
|
120
149
|
<dependency>
|
121
150
|
<groupId>in.wilsonl.minifyhtml</groupId>
|
122
151
|
<artifactId>minify-html</artifactId>
|
123
|
-
<version>0.
|
152
|
+
<version>0.9.2</version>
|
124
153
|
</dependency>
|
125
154
|
```
|
126
155
|
|
@@ -188,9 +217,39 @@ All [`Cfg` fields](https://docs.rs/minify-html/latest/minify_html/struct.Cfg.htm
|
|
188
217
|
|
189
218
|
</details>
|
190
219
|
|
220
|
+
<details>
|
221
|
+
<summary><img width="24" src="https://wilsonl.in/minify-html/icon/wasm.png"> <strong>WASM</strong></summary>
|
222
|
+
|
223
|
+
- Package: [@minify-html/wasm](https://npmjs.org/package/@minify-html/wasm)
|
224
|
+
- Binding: [WASM](https://webassembly.org/)
|
225
|
+
- Platforms: All
|
226
|
+
|
227
|
+
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.
|
228
|
+
|
229
|
+
### Use
|
230
|
+
|
231
|
+
```ts
|
232
|
+
import init, {minify} from "@minify-html/wasm";
|
233
|
+
|
234
|
+
const encoder = new TextEncoder();
|
235
|
+
const decoder = new TextDecoder();
|
236
|
+
|
237
|
+
await init();
|
238
|
+
|
239
|
+
const minified = decoder.decode(minify(encoder.encode("<p> Hello, world! </p>"), { keep_spaces_between_attributes: true, keep_comments: true }));
|
240
|
+
```
|
241
|
+
|
242
|
+
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`.
|
243
|
+
|
244
|
+
</details>
|
245
|
+
|
191
246
|
## Minification
|
192
247
|
|
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.
|
248
|
+
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:
|
249
|
+
|
250
|
+
- `do_not_minify_doctype`
|
251
|
+
- `ensure_spec_compliant_unquoted_attribute_values`
|
252
|
+
- `keep_spaces_between_attributes`
|
194
253
|
|
195
254
|
### Whitespace
|
196
255
|
|
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.2
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fiddle
|