minify_html 0.3.7 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb2d032ff7df2cda92929239361409352ecf8bb54d624d386f8f5cd29f48487
4
- data.tar.gz: cafc23354545a412a6cd20eeb823f66432c1a849d8fa45c8892f33e17204f547
3
+ metadata.gz: 4516f4975352060d252dc72ff441080f341114b8277cff7b62a3303a613279b7
4
+ data.tar.gz: 514facfe0ecb340f180d5b9c220291e59d375d5069bbda85bfbe9ceec08ce0dc
5
5
  SHA512:
6
- metadata.gz: 9cbbd22cfad76f3f9c0649b699facb83a78b264d5f132cb6a445b31831da7f62ad9369de6680df02dcbc3fdf3d0a656e1f5f87c46301072491e96eac17454944
7
- data.tar.gz: b57f2538fc5a7aebc7d0a972db31b72f1813bc38d4e5f6241b2eaa5e77e2bde36c7be54d23bf7eb2aa680874848e1814b3042bd4389583197593453029ae6aad
6
+ metadata.gz: 9c01002c64c63b3d83cc1b3a783b3e0ea782dbdda32685a0b0a8d9e9559c938d851d45ddaa2a22efc99bdade52f6791248a115174b7a0089ec1a3e2f800588d5
7
+ data.tar.gz: 85fa35d7d9e6f4c93211ea60f79d2a39b1177e9278ac4180efce136231b2d98bfbf1ef5a9ce2916878cf414c3b88bc7ed675f6a495c8772723318a0bec95ed00
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, available for Rust, Node.js, Python, Java, and Ruby.
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.3.7/js/average-speeds.png"> <img width="415" alt="Chart showing effectiveness of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.3.7/js/average-sizes.png">
15
+ <img width="415" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.4.1/js/average-speeds.png"> <img width="415" alt="Chart showing effectiveness of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.4.1/js/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.3.7-linux-x86_64) |
25
- [macOS](https://wilsonl.in/minify-html/bin/0.3.7-macos-x86_64) |
26
- [Windows](https://wilsonl.in/minify-html/bin/0.3.7-windows-x86_64.exe)
25
+ [Linux](https://wilsonl.in/minify-html/bin/0.4.1-linux-x86_64) |
26
+ [macOS](https://wilsonl.in/minify-html/bin/0.4.1-macos-x86_64) |
27
+ [Windows](https://wilsonl.in/minify-html/bin/0.4.1-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.3.7", features = ["js-esbuild"] }
46
+ minify-html = { version = "0.4.1", 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/evanw/esbuild).
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,21 +120,25 @@ Add as a Maven dependency:
119
120
  <dependency>
120
121
  <groupId>in.wilsonl.minifyhtml</groupId>
121
122
  <artifactId>minify-html</artifactId>
122
- <version>0.3.7</version>
123
+ <version>0.4.1</version>
123
124
  </dependency>
124
125
  ```
125
126
 
126
127
  ##### Use
127
128
 
128
129
  ```java
130
+ import in.wilsonl.minifyhtml.Configuration;
129
131
  import in.wilsonl.minifyhtml.MinifyHtml;
132
+ import in.wilsonl.minifyhtml.SyntaxException;
130
133
 
131
- MinifyHtml.Configuration cfg = new MinifyHtml.Configuration.Builder()
134
+ Configuration cfg = new Configuration.Builder()
132
135
  .setMinifyJs(false)
136
+ .setMinifyCss(false)
133
137
  .build();
138
+
134
139
  try {
135
140
  String minified = MinifyHtml.minify("<p> Hello, world! </p>", cfg);
136
- } catch (MinifyHtml.SyntaxException e) {
141
+ } catch (SyntaxException e) {
137
142
  System.err.println(e.getMessage());
138
143
  }
139
144
 
@@ -149,7 +154,7 @@ MinifyHtml.minifyInPlace(source, cfg);
149
154
 
150
155
  - Package: [minify-html](https://pypi.org/project/minify-html)
151
156
  - Binding: [PyO3](https://github.com/PyO3/pyo3)
152
- - Platforms: Linux, macOS, Windows; Python 3.5 and higher
157
+ - Platforms: Linux, macOS, Windows; Python 3.7 and higher
153
158
 
154
159
  ##### Get
155
160
 
@@ -161,7 +166,7 @@ Add the PyPI project as a dependency and install it using `pip` or `pipenv`.
161
166
  import minify_html
162
167
 
163
168
  try:
164
- 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)
165
170
  except SyntaxError as e:
166
171
  print(e)
167
172
  ```
@@ -184,7 +189,7 @@ Add the library as a dependency to `Gemfile` or `*.gemspec`.
184
189
  ```ruby
185
190
  require 'minify_html'
186
191
 
187
- print MinifyHtml.minify("<p> Hello, world! </p>", { :minify_js => false })
192
+ print MinifyHtml.minify("<p> Hello, world! </p>", { :minify_js => false, :minify_css => false })
188
193
  ```
189
194
 
190
195
  </details>
@@ -412,9 +417,7 @@ Numeric entities that do not refer to a valid [Unicode Scalar Value](https://www
412
417
 
413
418
  If an entity is unintentionally formed after decoding, the leading ampersand is encoded, e.g. `&&#97;&#109;&#112;;` becomes `&ampamp;`. This is done as `&amp` 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`.
414
419
 
415
- It's possible to get an unintentional entity after removing comments, e.g. `&am<!-- -->p`.
416
-
417
- Left chevrons after any decoding in text are encoded to `&LT` if possible or `&LT;` 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.
418
421
 
419
422
  ### Comments
420
423
 
Binary file
Binary file
Binary file
Binary file
Binary file
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.3.7
4
+ version: 0.4.1
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-08-24 00:00:00.000000000 Z
11
+ date: 2021-01-09 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 and smart HTML + JS minifier
65
+ summary: Extremely fast and smart HTML + JS + CSS minifier
66
66
  test_files: []