-
-
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
removeComments Plugin not working as expected. #1811
Comments
Update: It works if I open I think the problem is, since the comment starts with an Is there a way to do what I need without editing the |
You aren't doing anything wrong with SVGO. By default, the plugin preserves legal comments, which are prefixed with I can add a parameter to In this scenario, the comment is for copyright/licensing and allows you to meet the attribution requirement set out by the Font Awesome and Creative Commons licenses. By removing this you may be breaching the license terms, so unless you're paying for Font Awesome Pro, where attribution is not required, I'd discourage you from removing that comment. If you'd like an immediate solution, you can add a custom plugin for now: module.exports = {
plugins: [
{
name: "customRemoveComments",
fn: () => {
return {
comment: {
enter: (node, parentNode) => {
parentNode.children = parentNode.children.filter((child) => child !== node);
},
},
};
}
}
],
}; In v3.0.3 this will be possible without a custom plugin. The following will be possible to remove all comments indiscriminately: module.exports = {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeComments: {
preservePatterns: false,
},
},
},
},
],
}; |
Describe the bug
I want to remove comments from my SVG files:
The
removeComments
plugin is supposedly enabled by default, but the comments remain after processing. This is what I want to remove:<!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license Copyright 2023 Fonticons, Inc.-->
To Reproduce
Steps to reproduce the behavior:
svgo --config=svgo.config.js "FontAwesome Free 6 Light Album Circle Plus.svg"
Expected behavior
All comments to be nuked from the SVG file.
Desktop (please complete the following information):
Additional context
Not sure what I'm doing wrong. All I want to do is strip comments.
The text was updated successfully, but these errors were encountered: