-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
removeRasterImages skips some image formats #996
Comments
Perhaps instead of testing for various bitmap file formats, it should instead test to see if the if (item.isElem('image') &&
item.hasAttrLocal('href') &&
! item.hasAttrLocal('href', /(\.|image\/)svgz?/)) {
return false;
} The bitmap formats that browsers support can get pretty wacky ( |
I experienced this issue today. Simple jpg element embedded in a test svg. SVGO failed to remove it. Maybe a different cause, but this seems like it's still an open issue? This is with plugin UPDATE, CAUSE: Simply renaming "JPEG" to "JPG" in the image element, allowed it to be stripped by the plugin.
|
The issue with JPEG files specifically will be resolved in: |
The removeRasterImages plugin currently checks for the presence of raster images with a limited list of mime types:
item.hasAttrLocal('href', /(\.|image\/)(jpg|png|gif)/)
This misses certain types of mimetypes, mainly jpeg. A quick fix could be:
item.hasAttrLocal('href', /(\.|image\/)(jpg|jpeg|png|gif|webp|bmp|ico|jpe|jfif|tif|tiff)/)
I thought this would be too small a change to warrant a pull request, but if you want I could create one of those as well.
For other people wanting a quick fix without overriding the original plugin file add this to your list of plugins:
The text was updated successfully, but these errors were encountered: