mirror of
https://github.com/svg/svgo.git
synced 2025-07-28 09:22:00 +03:00
plugins/removeRasterImages: remove raster images references in <image> (disabled by default) (close #98)
This commit is contained in:
23
plugins/removeRasterImages.js
Normal file
23
plugins/removeRasterImages.js
Normal file
@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Remove raster images references in <image>.
|
||||
*
|
||||
* @see https://bugs.webkit.org/show_bug.cgi?id=63548
|
||||
*
|
||||
* @param {Object} item current iteration item
|
||||
* @return {Boolean} if false, item will be filtered out
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*/
|
||||
exports.removeRasterImages = function(item) {
|
||||
|
||||
if (
|
||||
item.isElem('image') &&
|
||||
item.hasAttr('xlink:href') &&
|
||||
/(\.|image\/)(jpg|png)/.test(item.attr('xlink:href').value)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
Reference in New Issue
Block a user