Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force creating a WebP file #3

Closed
TheodorTomas opened this issue Nov 28, 2018 · 10 comments
Closed

Force creating a WebP file #3

TheodorTomas opened this issue Nov 28, 2018 · 10 comments

Comments

@TheodorTomas
Copy link

TheodorTomas commented Nov 28, 2018

Do you want to request a feature or report a bug?

Possible bug/Feature idea

What is the current behaviour?

If the resulting WebP file is the same size as the original file the plugin does not create a WebP file.

What is the expected behaviour?

Should create a WebP file for each image matching the RegExp. This should possibly be optional by configuring the plugin with a force = true boolean. Otherwise it should be the default behaviour.

Example:

config: [{
test: /.(jpe?g)$/,
options: {
quality: 80,
force: true
}
}, {
test: /.(png)$/,
options: {
lossless: true,
force: true
}
}],

@iampava
Copy link
Owner

iampava commented Nov 28, 2018

Hey and thanks for contributing to this project :)

Can you give me an image which is the same size when converted to WebP, so that I can test the behavior and fix the bug?

@TheodorTomas
Copy link
Author

Hey @iampava, thanks for your quick reply. I can unfortunately not share the images that are causing me problems. I could possibly do some digging to find an image which causes the same problem. However I did some more investigating and found out that this is a feature/bug in imagemin. There are open issues in the imagemin-webp repo and the imagemin repo itself.

imagemin/imagemin-webp#13

@iampava
Copy link
Owner

iampava commented Nov 28, 2018

Oh snap... I was hoping it's a mistake on my side and not in the dependencies. I see that imagemin has a PR fixing this issue but it's not been merged yet: imagemin/imagemin#285

@TheodorTomas
Copy link
Author

Nice job finding a PR relating to this. Their code review process is quite extensive, I am not going to hold my breath waiting to get his merged. :P
I will have to add a a small hack to accommodate this issue in the meantime, but I hope this gets resolved soon.

@iampava
Copy link
Owner

iampava commented Nov 28, 2018

Hmm... now that I think about it I guess I could add a log message telling you if any of your images didn't get converted. This way, when you make the build you'll know if something went wrong

@iampava
Copy link
Owner

iampava commented Nov 28, 2018

Added this enhancement covering the change. I'm gonna take care of it on Friday ;)

#4

@iampava
Copy link
Owner

iampava commented Nov 30, 2018

Released version 2.0.0 with the added feature

@TheodorTomas
Copy link
Author

Hey @iampava, The PR fixing the root of this issue has been merged. I believe this should no longer be a problem in the newest version of "imagemin". PR: imagemin/imagemin@744a6c2

@iampava
Copy link
Owner

iampava commented Dec 27, 2018

Nice! Bumped up the dependency version. Will be in the next release, as soon as I fix #6

@iampava
Copy link
Owner

iampava commented Jan 1, 2019

Published v3.0.0 on NPM!

@iampava iampava closed this as completed Jan 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants