minify_html 0.3.8 → 0.4.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 +19 -19
- 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: cbc83589441ac0bc5861d3a31cd07d53429546c977e3023b99a8c43a961fe290
|
4
|
+
data.tar.gz: b275f7242f08923a719ac658bef9bae9efe33315f173d997c90377bebd73b06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d34c54ca36ab3ac4595143e4e49bc782f907334457008d92533f90ce4dfdb07624317f948508c8633f2c8cb40bde6030431d3e10fe896d34f91e88d6c5fbe6f
|
7
|
+
data.tar.gz: 699a40002e3f18c50147e23365297da8e8c58e920d08b5e723e18f64c29d615380a0563e98c945c9169da1f20077729001ea2c7557c35b3cd9f5255aad83eb09
|
data/README.md
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
# minify-html
|
2
2
|
|
3
|
-
An HTML minifier meticulously optimised for both speed and effectiveness
|
3
|
+
An HTML minifier meticulously optimised for both speed and effectiveness written in Rust.
|
4
|
+
Comes with native bindings to Node.js, Python, Java, and Ruby.
|
4
5
|
|
5
6
|
- Advanced minification strategy beats other minifiers with only one pass.
|
6
7
|
- Uses zero memory allocations, SIMD searching, direct tries, and lookup tables.
|
7
8
|
- Well tested with a large test suite and extensive [fuzzing](./fuzz).
|
8
|
-
- Natively binds to [esbuild](https://github.com/wilsonzlin/esbuild-rs) for super fast JS minification.
|
9
|
+
- Natively binds to [esbuild](https://github.com/wilsonzlin/esbuild-rs) for super fast JS and CSS minification.
|
9
10
|
|
10
11
|
## Performance
|
11
12
|
|
12
13
|
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)
|
13
14
|
|
14
|
-
<img width="415" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.
|
15
|
+
<img width="415" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.4.2/core/average-speeds.png"> <img width="415" alt="Chart showing effectiveness of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.4.2/core/average-sizes.png">
|
15
16
|
|
16
17
|
## Usage
|
17
18
|
|
@@ -21,16 +22,16 @@ Precompiled binaries are available for x86-64 Linux, macOS, and Windows.
|
|
21
22
|
|
22
23
|
##### Get
|
23
24
|
|
24
|
-
[Linux](https://wilsonl.in/minify-html/bin/0.
|
25
|
-
[macOS](https://wilsonl.in/minify-html/bin/0.
|
26
|
-
[Windows](https://wilsonl.in/minify-html/bin/0.
|
25
|
+
[Linux](https://wilsonl.in/minify-html/bin/0.4.2-linux-x86_64) |
|
26
|
+
[macOS](https://wilsonl.in/minify-html/bin/0.4.2-macos-x86_64) |
|
27
|
+
[Windows](https://wilsonl.in/minify-html/bin/0.4.2-windows-x86_64.exe)
|
27
28
|
|
28
29
|
##### Use
|
29
30
|
|
30
31
|
Use the `--help` argument for more details.
|
31
32
|
|
32
33
|
```bash
|
33
|
-
minify-html --src /path/to/src.html --out /path/to/output.min.html
|
34
|
+
minify-html --src /path/to/src.html --out /path/to/output.min.html --css --js
|
34
35
|
```
|
35
36
|
|
36
37
|
### API
|
@@ -42,12 +43,12 @@ minify-html --src /path/to/src.html --out /path/to/output.min.html
|
|
42
43
|
|
43
44
|
```toml
|
44
45
|
[dependencies]
|
45
|
-
minify-html = { version = "0.
|
46
|
+
minify-html = { version = "0.4.2", features = ["js-esbuild"] }
|
46
47
|
```
|
47
48
|
|
48
|
-
Building with the `js-esbuild` feature requires the Go compiler to be installed as well, to build the [JS minifier](https://github.com/
|
49
|
+
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).
|
49
50
|
|
50
|
-
If the `js-esbuild` feature is not enabled, `cfg.minify_js` will have no effect.
|
51
|
+
If the `js-esbuild` feature is not enabled, `cfg.minify_js` and `cfg.minify_css` will have no effect.
|
51
52
|
|
52
53
|
##### Use
|
53
54
|
|
@@ -81,7 +82,7 @@ yarn add @minify-html/js
|
|
81
82
|
```js
|
82
83
|
const minifyHtml = require("@minify-html/js");
|
83
84
|
|
84
|
-
const cfg = minifyHtml.createConfiguration({ minifyJs: false });
|
85
|
+
const cfg = minifyHtml.createConfiguration({ minifyJs: false, minifyCss: false });
|
85
86
|
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
|
86
87
|
|
87
88
|
// Alternatively, minify in place to avoid copying.
|
@@ -96,7 +97,7 @@ minify-html is also available for TypeScript:
|
|
96
97
|
import * as minifyHtml from "@minify-html/js";
|
97
98
|
import * as fs from "fs";
|
98
99
|
|
99
|
-
const cfg = minifyHtml.createConfiguration({ minifyJs: false });
|
100
|
+
const cfg = minifyHtml.createConfiguration({ minifyJs: false, minifyCss: false });
|
100
101
|
const minified = minifyHtml.minify("<p> Hello, world! </p>", cfg);
|
101
102
|
// Or alternatively:
|
102
103
|
const minified = minifyHtml.minifyInPlace(fs.readFileSync("source.html"), cfg);
|
@@ -119,7 +120,7 @@ Add as a Maven dependency:
|
|
119
120
|
<dependency>
|
120
121
|
<groupId>in.wilsonl.minifyhtml</groupId>
|
121
122
|
<artifactId>minify-html</artifactId>
|
122
|
-
<version>0.
|
123
|
+
<version>0.4.2</version>
|
123
124
|
</dependency>
|
124
125
|
```
|
125
126
|
|
@@ -132,6 +133,7 @@ import in.wilsonl.minifyhtml.SyntaxException;
|
|
132
133
|
|
133
134
|
Configuration cfg = new Configuration.Builder()
|
134
135
|
.setMinifyJs(false)
|
136
|
+
.setMinifyCss(false)
|
135
137
|
.build();
|
136
138
|
|
137
139
|
try {
|
@@ -152,7 +154,7 @@ MinifyHtml.minifyInPlace(source, cfg);
|
|
152
154
|
|
153
155
|
- Package: [minify-html](https://pypi.org/project/minify-html)
|
154
156
|
- Binding: [PyO3](https://github.com/PyO3/pyo3)
|
155
|
-
- Platforms: Linux, macOS, Windows; Python 3.
|
157
|
+
- Platforms: Linux, macOS, Windows; Python 3.7 and higher
|
156
158
|
|
157
159
|
##### Get
|
158
160
|
|
@@ -164,7 +166,7 @@ Add the PyPI project as a dependency and install it using `pip` or `pipenv`.
|
|
164
166
|
import minify_html
|
165
167
|
|
166
168
|
try:
|
167
|
-
minified = minify_html.minify("<p> Hello, world! </p>", minify_js=False)
|
169
|
+
minified = minify_html.minify("<p> Hello, world! </p>", minify_js=False, minify_css=False)
|
168
170
|
except SyntaxError as e:
|
169
171
|
print(e)
|
170
172
|
```
|
@@ -187,7 +189,7 @@ Add the library as a dependency to `Gemfile` or `*.gemspec`.
|
|
187
189
|
```ruby
|
188
190
|
require 'minify_html'
|
189
191
|
|
190
|
-
print MinifyHtml.minify("<p> Hello, world! </p>", { :minify_js => false })
|
192
|
+
print MinifyHtml.minify("<p> Hello, world! </p>", { :minify_js => false, :minify_css => false })
|
191
193
|
```
|
192
194
|
|
193
195
|
</details>
|
@@ -415,9 +417,7 @@ Numeric entities that do not refer to a valid [Unicode Scalar Value](https://www
|
|
415
417
|
|
416
418
|
If an entity is unintentionally formed after decoding, the leading ampersand is encoded, e.g. `&amp;` becomes `&amp;`. This is done as `&` is equal to or shorter than all other entity representations of characters part of an entity (`[&#a-zA-Z0-9;]`), and there is no other conflicting entity name that starts with `amp`.
|
417
419
|
|
418
|
-
|
419
|
-
|
420
|
-
Left chevrons after any decoding in text are encoded to `<` if possible or `<` otherwise.
|
420
|
+
Note that it's possible to get an unintentional entity after removing comments, e.g. `&am<!-- -->p`; minify-html will **not** encode the leading ampersand.
|
421
421
|
|
422
422
|
### Comments
|
423
423
|
|
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.4.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:
|
11
|
+
date: 2021-02-05 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:
|
65
|
+
summary: Extremely fast and smart HTML + JS + CSS minifier
|
66
66
|
test_files: []
|