Opened 4 months ago
Last modified 5 weeks ago
#58996 new enhancement
Consider removing the "imagemin" task from Grunt
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch 2nd-opinion |
Focuses: | Cc: |
Description
WordPress uses Imagemin in Grunt to minify new images. However it seems the last time new (non svg) images were added was 7 years ago. See:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/images?order=date&desc=1
https://core.trac.wordpress.org/browser/trunk/src/wp-admin/images?order=date&desc=1
Seems the imagemin
task in Grunt has been redundant for a long time. Perhaps would be good to retire it and go back to minifying new images "by hand" before committing them, if non-svg images are ever added again.
Attachments (1)
Change History (4)
#2
in reply to:
↑ 1
@
4 months ago
Replying to desrosj:
It's true that within those two directories images have not been added, but there have been lots of images added to the
wp-content/themes
directory. I think it's probably worth looking at expanding theimagemin
task to include themes.
I agree, it seems like the task would still be beneficial for themes.
I'm not sure that relying on "by hand" is the best path here. Even for experienced contributors and committers, it's very easy to forget steps like this when it's not often images are added.
It's true that within those two directories images have not been added, but there have been lots of images added to the
wp-content/themes
directory. I think it's probably worth looking at expanding theimagemin
task to include themes.I attached a patch that expands to theme directories, and running
npm run grunt precommit:image
results in 106 images being minified, and seems to save ~1KB per image within the theme.The fact that the images within themes can be further minified is a good example of forgetting to manually perform minifying prior to committing.