Giter Site home page Giter Site logo

Comments (7)

Frank3K avatar Frank3K commented on August 15, 2024 2

Proof of concept using iltorb:

let brotliCompress = require('iltorb').compress;
...
new CompressionPlugin({
    asset: "[path].br",
    algorithm: function (buf, options, callback) {
      brotliCompress(buf, {
        mode: 0, // 0 = generic, 1 = text, 2 = font (WOFF2)
        quality: 11, // 0 - 11
        lgwin: 22, // window size
        lgblock: 0 // block size
      }, callback);
    },
    threshold: 0,
    minRatio: 1
});

from compression-webpack-plugin.

Frank3K avatar Frank3K commented on August 15, 2024

There exists a JS version of the brotli compressor and decompressor: brotli.js. Would it be possible to integrate that one?

from compression-webpack-plugin.

swernerx avatar swernerx commented on August 15, 2024

For this it would be useful to have multiple outputs as well e.g. brotli + zopfli so that in one plugin step both "files" could be created for widest possible client support.

(Also another obvious requirement would be multiple parallel file processing aka workers(/threads as both algos are pretty slow)

from compression-webpack-plugin.

michael-ciniawsky avatar michael-ciniawsky commented on August 15, 2024

We consider testing and documenting how to use third party algos (brotli, zopfli, guetzli, ...) with this plugin and by default ship zlib (gzip) only, mainly bc of native modules support

new CompressionPlugin({
    asset: "[path].[compression].[ext]",
    algorithm: function (buffer, options, cb) { ...third party implementation here... }
})

Also another obvious requirement would be multiple parallel file processing aka workers(/threads as both algos are pretty slow

@swernerx If you have a solution in mind send PR highly welcome and appreciated 😛

from compression-webpack-plugin.

joshwiens avatar joshwiens commented on August 15, 2024

@swernerx - We were just discussing this. Some if not most of these libs have varying system & compilation requirements making adding X number of compression libs problematic at best. They are also far from tiny on disk.

We are going the other direction with all of this, node-zopfli is going to be split into it's own compression plugin. The existing compression-webpack-plugin with handle compression with gzip, those wanting to use zopfli will have a new lib with an identical API and none of the optional dependency annoyances or the ever growing list of algorithms people want to use.

from compression-webpack-plugin.

Enalmada avatar Enalmada commented on August 15, 2024

I am currently using https://www.npmjs.com/package/shrink-ray-current to get br compression on everything. I like that it returns appropriate dynamic compression for the initial response and then asynchronously recompresses with max compression for subsequent requests. Still, I found this thread because I would ideally like to br compress all assets with max compression at build time. I think it would be helpful readme had an example, to quote swernerx, of multiple outputs (brotli + zopfli) so that in one plugin step both "files" could be created for widest possible client support.

from compression-webpack-plugin.

nicksrandall avatar nicksrandall commented on August 15, 2024

node 11.7 (should be released any day now) will have native support for brotli compression.

See nodejs/node#25537

from compression-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.