Make WordPress Core

Opened 4 months ago

Last modified 3 months ago

#62188 assigned enhancement

Update `imagemin` tasks to run on modern image formats

Reported by: desrosj's profile desrosj Owned by: pbearne's profile pbearne
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: performance Cc:

Description

The dependency currently used to ensure images are properly minified is grunt-contrib-imagemin. It seems that JPG, PNG, GIF, and SVG are the only currently supported formats.

[57322] expanded the task to also minify images in default themes. But as of 6.7, there will now be 2 default themes that ship with WebP images.

Alternative image minification packages with better support for modern formats should be looked at to ensure these images are also properly compressed.

Change History (5)

This ticket was mentioned in PR #7690 on WordPress/wordpress-develop by @pbearne.


3 months ago
#1

  • Keywords has-patch added

Implemented 'cwebp' Grunt task to convert images to WebP format. Updated 'precommit:image' task to include 'cwebp:dynamic' ensuring WebP conversion during pre-commit.

#2 @pbearne
3 months ago

  • Owner set to pbearne
  • Status changed from new to assigned

#3 @pbearne
3 months ago

I have added grunt-cwebp to handle webp files

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.


3 months ago

@desrosj commented on PR #7690:


3 months ago
#5

I agree with the image quality likely being far too low. It seems Core uses 86 as the default for WebP. I think matching that is a good start.

Were there specific reasons for choosing grunt-cwebp over some of the other available options, such as Ayesh/grunt-webp? The former has not been updated in 4 years, but the latter was updated 2 years ago and @ayesh is an active member of the community, so it may be easier to get any needed updates released.

There's also some additional options such as lossless, and deleteLarger in Ayesh/grunt-webp. I wonder if configuring these would be beneficial as well.

Note: See TracTickets for help on using tickets.