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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 055bf7f938939297d648f7d42eeec19a1bfeb55351f98e62352bc71bbcdee9bc
4
- data.tar.gz: b5c92f3ae32547257335917ebeff230f2cb5dc082ce5ffaac87dff9c257c86fb
3
+ metadata.gz: 697e2591534633035e8aab9afb878292c2e9caad26d82bbdeadb31a03452f95d
4
+ data.tar.gz: 75a99b0c3ff75e820f7b88b7ba9ff5337baea5c6fc1ecccb61fd688f2246db62
5
5
  SHA512:
6
- metadata.gz: 668db2a4213b8c491ef16b159f3e8e069ebd293c592064aa49d1dabb13d0de3b7d9c429772f1ec5c2b36d2847d99b86d9de3ee7dd93b9c94cfe98930bb52280a
7
- data.tar.gz: ee8fe2a4100525ac354bfc5b8a8196e1a5599abeecff8213a5094826e3aab4b3bf5b4fa1e9e9be2e4bbd9960e67ae8f359093d848803cf6ca10394eea6f0545d
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
- - Natively binds to [esbuild](https://github.com/wilsonzlin/esbuild-rs) for super fast JS and CSS minification.
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-minfier](https://github.com/kangax/html-minifier) and [minimize](https://github.com/Swaagie/minimize), run on the top web pages. [See the breakdown here.](./bench)
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.8.1/core/average-speeds.png"><img width="400" alt="Chart showing compression of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.8.1/core/average-sizes.png">
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.8.1-linux-x86_64) |
36
- [Linux ARM64](https://wilsonl.in/minify-html/bin/0.8.1-linux-arm64) |
37
- [macOS x64](https://wilsonl.in/minify-html/bin/0.8.1-macos-x86_64) |
38
- [macOS ARM64](https://wilsonl.in/minify-html/bin/0.8.1-macos-arm64) |
39
- [Windows x64](https://wilsonl.in/minify-html/bin/0.8.1-windows-x86_64.exe)
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.8.1", features = ["js-esbuild"] }
62
+ minify-html = { version = "0.9.0" }
59
63
  ```
60
64
 
61
- Building with the `js-esbuild` feature requires the Go compiler to be installed as well, to build the [JS and CSS minifier](https://github.com/wilsonzlin/esbuild-rs).
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
- If the `js-esbuild` feature is not enabled, `cfg.minify_js` and `cfg.minify_css` will have no effect.
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
- Check out the [docs](https://docs.rs/minify-html) for API and usage examples.
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/js](https://www.npmjs.com/package/@minify-html/js)
75
- - Binding: [N-API](https://nodejs.org/api/n-api.html)
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/js
107
+ npm i @minify-html/node
84
108
  ```
85
109
 
86
110
  Using Yarn:
87
111
 
88
112
  ```bash
89
- yarn add @minify-html/js
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/js";
98
- // Or `const minifyHtml = require("@minify-html/js")` if not using TS/ESM.
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 cfg = minifyHtml.createConfiguration({ keep_spaces_between_attributes: true, keep_comments: true });
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 to `createConfiguration`; if any are not set, they default to `false`.
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.8.1</version>
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. These can be turned off via the `Cfg` object.
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.8.1
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-17 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fiddle