summaryrefslogtreecommitdiff
path: root/node_modules/svgo/plugins/removeComments.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/svgo/plugins/removeComments.js')
-rw-r--r--node_modules/svgo/plugins/removeComments.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/node_modules/svgo/plugins/removeComments.js b/node_modules/svgo/plugins/removeComments.js
new file mode 100644
index 00000000..70e46271
--- /dev/null
+++ b/node_modules/svgo/plugins/removeComments.js
@@ -0,0 +1,29 @@
+'use strict';
+
+const { detachNodeFromParent } = require('../lib/xast.js');
+
+exports.name = 'removeComments';
+exports.description = 'removes comments';
+
+/**
+ * Remove comments.
+ *
+ * @example
+ * <!-- Generator: Adobe Illustrator 15.0.0, SVG Export
+ * Plug-In . SVG Version: 6.00 Build 0) -->
+ *
+ * @author Kir Belevich
+ *
+ * @type {import('./plugins-types').Plugin<'removeComments'>}
+ */
+exports.fn = () => {
+ return {
+ comment: {
+ enter: (node, parentNode) => {
+ if (node.value.charAt(0) !== '!') {
+ detachNodeFromParent(node, parentNode);
+ }
+ },
+ },
+ };
+};