minify_html 0.2.6 → 0.3.0
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 +34 -40
- 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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50a50e82c1b1eb818544eafc2b5c3e7814ae5ea409433a2e179e4bc1db9a54eb
|
4
|
+
data.tar.gz: 0ce046bebc23ff8242bc1b97fe956ae214091325820347163d171f1403dd2eef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f234cc0fb45b7a55094d4316b3fdea5131c9befe71677438f8286109329aca94dad91ef6e0353b01248c0b4d172ddc800bc546d05f12c8538201fdbcfe5c6d0
|
7
|
+
data.tar.gz: e6ccbe2f3913d0c94de8a7b7b48af353626fdc9c62dbdb46355263a4a42eef752005b5a61f1e9c71d8ff88641564d066009d37be05422958c64741b78513d929
|
data/README.md
CHANGED
@@ -1,37 +1,29 @@
|
|
1
1
|
# minify-html
|
2
2
|
|
3
|
-
|
3
|
+
An HTML minifier meticulously optimised for both speed and effectiveness, available for Rust, Node.js, Python, Java, and Ruby.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Available as:
|
8
|
-
- CLI for macOS and Linux.
|
9
|
-
- Rust library.
|
10
|
-
- Native library for Node.js, Python, Java, and Ruby.
|
11
|
-
|
12
|
-
## Features
|
13
|
-
|
14
|
-
- Minification is done in one pass with no backtracking or DOM/AST building.
|
15
|
-
- No extra heap memory is allocated during processing, which increases performance.
|
16
|
-
- Context-aware whitespace handling allows maximum minification while retaining desired spaces.
|
5
|
+
- Advanced minification strategy beats other minifiers with only one pass.
|
6
|
+
- Uses zero memory allocations, SIMD searching, direct tries, and lookup tables.
|
17
7
|
- Well tested with a large test suite and extensive [fuzzing](./fuzz).
|
8
|
+
- Natively binds to [esbuild](https://github.com/evanw/esbuild) for super fast JS minification.
|
18
9
|
|
19
10
|
## Performance
|
20
11
|
|
21
|
-
|
12
|
+
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)
|
22
13
|
|
23
|
-
<img width="
|
14
|
+
<img width="415" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.3.0/average-speeds.png"> <img width="415" alt="Chart showing effectiveness of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.3.0/average-sizes.png">
|
24
15
|
|
25
16
|
## Usage
|
26
17
|
|
27
18
|
### CLI
|
28
19
|
|
29
|
-
Precompiled binaries are available for x86-64 macOS and
|
20
|
+
Precompiled binaries are available for x86-64 Linux, macOS, and Windows.
|
30
21
|
|
31
22
|
##### Get
|
32
23
|
|
33
|
-
[
|
34
|
-
[
|
24
|
+
[Linux](https://wilsonl.in/minify-html/bin/0.3.0-linux-x86_64) |
|
25
|
+
[macOS](https://wilsonl.in/minify-html/bin/0.3.0-macos-x86_64) |
|
26
|
+
[Windows](https://wilsonl.in/minify-html/bin/0.3.0-windows-x86_64)
|
35
27
|
|
36
28
|
##### Use
|
37
29
|
|
@@ -50,7 +42,7 @@ minify-html --src /path/to/src.html --out /path/to/output.min.html
|
|
50
42
|
|
51
43
|
```toml
|
52
44
|
[dependencies]
|
53
|
-
minify-html = { version = "0.
|
45
|
+
minify-html = { version = "0.3.0", features = ["js-esbuild"] }
|
54
46
|
```
|
55
47
|
|
56
48
|
Building with the `js-esbuild` feature requires the Go compiler to be installed as well, to build the [JS minifier](https://github.com/evanw/esbuild).
|
@@ -108,46 +100,48 @@ fn main() {
|
|
108
100
|
<details>
|
109
101
|
<summary><strong>Node.js</strong></summary>
|
110
102
|
|
111
|
-
Package: [@minify-html/js
|
112
|
-
Binding: [
|
113
|
-
Platforms: macOS,
|
103
|
+
- Package: [@minify-html/js](https://www.npmjs.com/package/@minify-html/js)
|
104
|
+
- Binding: [N-API](https://nodejs.org/api/n-api.html)
|
105
|
+
- Platforms: Linux, macOS, Windows; Node.js 8.6.0 and higher
|
114
106
|
|
115
107
|
##### Get
|
116
108
|
|
117
109
|
Using npm:
|
118
110
|
|
119
111
|
```bash
|
120
|
-
npm i @minify-html/js
|
112
|
+
npm i @minify-html/js
|
121
113
|
```
|
122
114
|
|
123
115
|
Using Yarn:
|
124
116
|
|
125
117
|
```bash
|
126
|
-
yarn add @minify-html/js
|
118
|
+
yarn add @minify-html/js
|
127
119
|
```
|
128
120
|
|
129
121
|
##### Use
|
130
122
|
|
131
123
|
```js
|
132
|
-
const minifyHtml = require("@minify-html/js
|
124
|
+
const minifyHtml = require("@minify-html/js");
|
133
125
|
|
134
126
|
const cfg = { minifyJs: false };
|
135
127
|
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
|
136
128
|
|
137
129
|
// Alternatively, minify in place to avoid copying.
|
138
|
-
const source = Buffer.from("<p> Hello, world! </p>"
|
139
|
-
|
130
|
+
const source = Buffer.from("<p> Hello, world! </p>");
|
131
|
+
// This is a Buffer representing a slice of `source`, not newly allocated memory.
|
132
|
+
const minified = minifyHtml.minifyInPlace(source, cfg);
|
140
133
|
```
|
141
134
|
|
142
135
|
minify-html is also available for TypeScript:
|
143
136
|
|
144
137
|
```ts
|
145
|
-
import * as minifyHtml from "@minify-html/js
|
138
|
+
import * as minifyHtml from "@minify-html/js";
|
146
139
|
import * as fs from "fs";
|
147
140
|
|
148
141
|
const cfg = { minifyJs: false };
|
149
142
|
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
|
150
|
-
|
143
|
+
// Or alternatively:
|
144
|
+
const minified = minifyHtml.minifyInPlace(fs.readFileSync("source.html"), cfg);
|
151
145
|
```
|
152
146
|
|
153
147
|
</details>
|
@@ -155,9 +149,9 @@ minifyHtml.minifyInPlace(fs.readFileSync("source.html"), cfg);
|
|
155
149
|
<details>
|
156
150
|
<summary><strong>Java</strong></summary>
|
157
151
|
|
158
|
-
Package: [in.wilsonl.minifyhtml](https://search.maven.org/artifact/in.wilsonl.minifyhtml/minify-html)
|
159
|
-
Binding: [JNI](https://github.com/jni-rs/jni-rs)
|
160
|
-
Platforms: macOS,
|
152
|
+
- Package: [in.wilsonl.minifyhtml](https://search.maven.org/artifact/in.wilsonl.minifyhtml/minify-html)
|
153
|
+
- Binding: [JNI](https://github.com/jni-rs/jni-rs)
|
154
|
+
- Platforms: Linux, macOS, Windows; Java 7 and higher
|
161
155
|
|
162
156
|
##### Get
|
163
157
|
|
@@ -167,14 +161,14 @@ Add as a Maven dependency:
|
|
167
161
|
<dependency>
|
168
162
|
<groupId>in.wilsonl.minifyhtml</groupId>
|
169
163
|
<artifactId>minify-html</artifactId>
|
170
|
-
<version>0.
|
164
|
+
<version>0.3.0</version>
|
171
165
|
</dependency>
|
172
166
|
```
|
173
167
|
|
174
168
|
##### Use
|
175
169
|
|
176
170
|
```java
|
177
|
-
import in.wilsonl.
|
171
|
+
import in.wilsonl.minifyhtml.MinifyHtml;
|
178
172
|
|
179
173
|
MinifyHtml.Configuration cfg = new MinifyHtml.Configuration.Builder()
|
180
174
|
.setMinifyJs(false)
|
@@ -195,9 +189,9 @@ MinifyHtml.minifyInPlace(source, cfg);
|
|
195
189
|
<details>
|
196
190
|
<summary><strong>Python</strong></summary>
|
197
191
|
|
198
|
-
Package: [
|
199
|
-
Binding: [PyO3](https://github.com/PyO3/pyo3)
|
200
|
-
Platforms: macOS,
|
192
|
+
- Package: [minify-html](https://pypi.org/project/minify-html)
|
193
|
+
- Binding: [PyO3](https://github.com/PyO3/pyo3)
|
194
|
+
- Platforms: Linux, macOS, Windows; Python 3.5 and higher
|
201
195
|
|
202
196
|
##### Get
|
203
197
|
|
@@ -219,9 +213,9 @@ except SyntaxError as e:
|
|
219
213
|
<details>
|
220
214
|
<summary><strong>Ruby</strong></summary>
|
221
215
|
|
222
|
-
Package: [minify_html](https://rubygems.org/gems/minify_html)
|
223
|
-
Binding: [Rutie](https://github.com/danielpclark/rutie)
|
224
|
-
Platforms:
|
216
|
+
- Package: [minify_html](https://rubygems.org/gems/minify_html)
|
217
|
+
- Binding: [Rutie](https://github.com/danielpclark/rutie)
|
218
|
+
- Platforms: Linux, macOS; Ruby 2.5 and higher
|
225
219
|
|
226
220
|
##### Get
|
227
221
|
|
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.3.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: 2020-07-
|
11
|
+
date: 2020-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fiddle
|
@@ -62,5 +62,5 @@ rubyforge_project:
|
|
62
62
|
rubygems_version: 2.7.6.2
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
|
-
summary: Fast
|
65
|
+
summary: Fast and smart HTML + JS minifier
|
66
66
|
test_files: []
|