minify_html 0.3.0 → 0.3.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 +4 -4
- data/README.md +12 -12
- 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: 4ea35c06e996f8ecb149de11b7272ddd9445f753083089ed2f1d4c337d899c08
         | 
| 4 | 
            +
              data.tar.gz: 645892b6e8a3f5c2cbae4dbde5f63edf5fc8e22bac870a754297d56fd766080e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e30d201610b78cbaffeaf1eb74e11d4dc8470279aff241c7a4f648613c84bbce37c6b2d8f23af16a4e6de83fff0c5af91d020f0c7a4fa38589459611efae40e3
         | 
| 7 | 
            +
              data.tar.gz: 85b319ff241dad8bd477e6f1ccaf4e628b4de6761355c46276c3742a462cdc63e5c43716ae89e24e4679343b7b6fbad73d7e2bae42e85b7e8fb62e90ca694fe8
         | 
    
        data/README.md
    CHANGED
    
    | @@ -11,7 +11,7 @@ An HTML minifier meticulously optimised for both speed and effectiveness, availa | |
| 11 11 |  | 
| 12 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)
         | 
| 13 13 |  | 
| 14 | 
            -
            <img width="415" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.3. | 
| 14 | 
            +
            <img width="415" alt="Chart showing speed of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.3.1/js/average-speeds.png"> <img width="415" alt="Chart showing effectiveness of HTML minifiers" src="https://wilsonl.in/minify-html/bench/0.3.1/js/average-sizes.png">
         | 
| 15 15 |  | 
| 16 16 | 
             
            ## Usage
         | 
| 17 17 |  | 
| @@ -21,9 +21,9 @@ Precompiled binaries are available for x86-64 Linux, macOS, and Windows. | |
| 21 21 |  | 
| 22 22 | 
             
            ##### Get
         | 
| 23 23 |  | 
| 24 | 
            -
            [Linux](https://wilsonl.in/minify-html/bin/0.3. | 
| 25 | 
            -
            [macOS](https://wilsonl.in/minify-html/bin/0.3. | 
| 26 | 
            -
            [Windows](https://wilsonl.in/minify-html/bin/0.3. | 
| 24 | 
            +
            [Linux](https://wilsonl.in/minify-html/bin/0.3.1-linux-x86_64) |
         | 
| 25 | 
            +
            [macOS](https://wilsonl.in/minify-html/bin/0.3.1-macos-x86_64) |
         | 
| 26 | 
            +
            [Windows](https://wilsonl.in/minify-html/bin/0.3.1-windows-x86_64.exe)
         | 
| 27 27 |  | 
| 28 28 | 
             
            ##### Use
         | 
| 29 29 |  | 
| @@ -42,7 +42,7 @@ minify-html --src /path/to/src.html --out /path/to/output.min.html | |
| 42 42 |  | 
| 43 43 | 
             
            ```toml
         | 
| 44 44 | 
             
            [dependencies]
         | 
| 45 | 
            -
            minify-html = { version = "0.3. | 
| 45 | 
            +
            minify-html = { version = "0.3.1", features = ["js-esbuild"] }
         | 
| 46 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).
         | 
| @@ -52,7 +52,7 @@ If the `js-esbuild` feature is not enabled, `cfg.minify_js` will have no effect. | |
| 52 52 | 
             
            ##### Use
         | 
| 53 53 |  | 
| 54 54 | 
             
            ```rust
         | 
| 55 | 
            -
            use minify_html::{Cfg, FriendlyError, in_place, copy, with_friendly_error, truncate};
         | 
| 55 | 
            +
            use minify_html::{Cfg, Error, FriendlyError, in_place, copy, with_friendly_error, truncate};
         | 
| 56 56 |  | 
| 57 57 | 
             
            fn main() {
         | 
| 58 58 | 
             
                let mut code = b"<p>  Hello, world!  </p>".to_vec();
         | 
| @@ -64,21 +64,21 @@ fn main() { | |
| 64 64 | 
             
                // but leaves any original code after the minified code intact.
         | 
| 65 65 | 
             
                match in_place(&mut code, cfg) {
         | 
| 66 66 | 
             
                    Ok(minified_len) => {}
         | 
| 67 | 
            -
                    Err( | 
| 67 | 
            +
                    Err(Error { error_type, position }) => {}
         | 
| 68 68 | 
             
                };
         | 
| 69 69 |  | 
| 70 70 | 
             
                // Creates a vector copy containing only minified code
         | 
| 71 71 | 
             
                // instead of minifying in-place.
         | 
| 72 72 | 
             
                match copy(&code, cfg) {
         | 
| 73 73 | 
             
                    Ok(minified) => {}
         | 
| 74 | 
            -
                    Err( | 
| 74 | 
            +
                    Err(Error { error_type, position }) => {}
         | 
| 75 75 | 
             
                };
         | 
| 76 76 |  | 
| 77 77 | 
             
                // Minifies a vector in-place, and then truncates the
         | 
| 78 78 | 
             
                // vector to the new minified length.
         | 
| 79 79 | 
             
                match truncate(&mut code, cfg) {
         | 
| 80 80 | 
             
                    Ok(()) => {}
         | 
| 81 | 
            -
                    Err( | 
| 81 | 
            +
                    Err(Error { error_type, position }) => {}
         | 
| 82 82 | 
             
                };
         | 
| 83 83 |  | 
| 84 84 | 
             
                // Identical to `in_place` except with FriendlyError instead.
         | 
| @@ -123,7 +123,7 @@ yarn add @minify-html/js | |
| 123 123 | 
             
            ```js
         | 
| 124 124 | 
             
            const minifyHtml = require("@minify-html/js");
         | 
| 125 125 |  | 
| 126 | 
            -
            const cfg = { minifyJs: false };
         | 
| 126 | 
            +
            const cfg = minifyHtml.createConfiguration({ minifyJs: false });
         | 
| 127 127 | 
             
            const minified = minifyHtml.minify("<p>  Hello, world!  </p>", cfg);
         | 
| 128 128 |  | 
| 129 129 | 
             
            // Alternatively, minify in place to avoid copying.
         | 
| @@ -138,7 +138,7 @@ minify-html is also available for TypeScript: | |
| 138 138 | 
             
            import * as minifyHtml from "@minify-html/js";
         | 
| 139 139 | 
             
            import * as fs from "fs";
         | 
| 140 140 |  | 
| 141 | 
            -
            const cfg = { minifyJs: false };
         | 
| 141 | 
            +
            const cfg = minifyHtml.createConfiguration({ minifyJs: false });
         | 
| 142 142 | 
             
            const minified = minifyHtml.minify("<p>  Hello, world!  </p>", cfg);
         | 
| 143 143 | 
             
            // Or alternatively:
         | 
| 144 144 | 
             
            const minified = minifyHtml.minifyInPlace(fs.readFileSync("source.html"), cfg);
         | 
| @@ -161,7 +161,7 @@ Add as a Maven dependency: | |
| 161 161 | 
             
            <dependency>
         | 
| 162 162 | 
             
              <groupId>in.wilsonl.minifyhtml</groupId>
         | 
| 163 163 | 
             
              <artifactId>minify-html</artifactId>
         | 
| 164 | 
            -
              <version>0.3. | 
| 164 | 
            +
              <version>0.3.1</version>
         | 
| 165 165 | 
             
            </dependency>
         | 
| 166 166 | 
             
            ```
         | 
| 167 167 |  | 
    
        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.3. | 
| 4 | 
            +
              version: 0.3.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-07- | 
| 11 | 
            +
            date: 2020-07-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: fiddle
         |