mirror of
https://github.com/svg/svgo.git
synced 2025-08-09 02:22:08 +03:00
added removeDesc plugin
This commit is contained in:
@@ -45,3 +45,4 @@ plugins:
|
|||||||
- transformsWithOnePath
|
- transformsWithOnePath
|
||||||
- sortAttrs
|
- sortAttrs
|
||||||
- removeTitle
|
- removeTitle
|
||||||
|
- removeDesc
|
@@ -23,7 +23,8 @@ SVGO имеет расширяемую архитектуру, в которой
|
|||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeXMLProcInst.js) ] удаление XML-инструкций
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeXMLProcInst.js) ] удаление XML-инструкций
|
||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeComments.js) ] удаление комментариев
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeComments.js) ] удаление комментариев
|
||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeMetadata.js) ] удаление `<metadata>`
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeMetadata.js) ] удаление `<metadata>`
|
||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeTitle.js) ] удаление `<title>`
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeTitle.js) ] удаление `<title>` (отключена по умолчанию)
|
||||||
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeDesc.js) ] удаление `<desc>` (отключена по умолчанию)
|
||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeEditorsNSData.js) ] удаление пространств имён различных редакторов, их элементов и атрибутов
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeEditorsNSData.js) ] удаление пространств имён различных редакторов, их элементов и атрибутов
|
||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeEmptyAttrs.js) ] удаление пустых атрибутов
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeEmptyAttrs.js) ] удаление пустых атрибутов
|
||||||
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeHiddenElems.js) ] удаление скрытых элементов
|
* [ [>](https://github.com/svg/svgo/blob/master/plugins/removeHiddenElems.js) ] удаление скрытых элементов
|
||||||
|
22
plugins/removeDesc.js
Normal file
22
plugins/removeDesc.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
exports.type = 'perItem';
|
||||||
|
|
||||||
|
exports.active = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove <desc>.
|
||||||
|
* Disabled by default cause it may be used for accessibility.
|
||||||
|
*
|
||||||
|
* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
|
||||||
|
*
|
||||||
|
* @param {Object} item current iteration item
|
||||||
|
* @return {Boolean} if false, item will be filtered out
|
||||||
|
*
|
||||||
|
* @author Daniel Wabyick
|
||||||
|
*/
|
||||||
|
exports.fn = function(item) {
|
||||||
|
|
||||||
|
return !item.isElem('desc');
|
||||||
|
|
||||||
|
};
|
10
test/plugins/removeDesc.01.svg
Normal file
10
test/plugins/removeDesc.01.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<desc>...</desc>
|
||||||
|
<g/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
@@@
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 141 B |
Reference in New Issue
Block a user