Skip to content

Conversation

kellymears
Copy link
Contributor

@kellymears kellymears commented Dec 21, 2021

Type of change

  • MINOR: feature

Dependencies added

  • @squoosh/lib

Details

  • fix: imagemin-webpack-plugin v3
  • improve: swap out imagemin implementation for @squoosh/lib
  • docs: update with new api

Benefits

  • Squoosh squishes just about errything.
  • It's less of a burden to manage the peer dependencies.
  • It's faster to install in CI.
  • this snapshot diff basically: -76.6 KB (47%) tests/integration/__snapshots__/imagemin.test.ts.snap

By default, once installed, the extension will lossily compress everything it can. All the assets I've tried look great and are much smaller than what imagemin emits. But, if someone wants lossless compression or to do something wildly different, they can still configure squoosh with bud.imagemin.

Our default config will convert assets to webp if you append ?as=webp to an asset url / import.

background: url('images/pic.png?as=webp');

Configuring

From updated docs:

To compress assets losslessly:

bud.imagemin('lossless')

To compress assets in a lossy manner:

bud.imagemin('lossy')

Custom config

To provide your own configuration options you can pass a callback which
will receive and should return the options.

bud.imagemin(options => ({
  ...options,
  // ...override
}))

@kellymears kellymears added this to the 5.1.0 milestone Dec 21, 2021
@kellymears kellymears requested review from retlehs and QWp6t December 21, 2021 13:21
@kellymears kellymears self-assigned this Dec 21, 2021
@github-actions github-actions bot added @roots/bud-imagemin dependencies Pull requests that update a dependency file docs examples labels Dec 21, 2021
@github-actions github-actions bot added the test label Dec 21, 2021
Co-authored-by: QWp6t <QWp6t@users.noreply.github.com>
@kellymears kellymears merged commit 58ad75d into next Dec 22, 2021
@kellymears kellymears deleted the image-minimizer-upgrade branch December 22, 2021 22:38
@kellymears kellymears mentioned this pull request Dec 22, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file docs examples @roots/bud-imagemin test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants