-
-
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
Doctype persists after svgo, newline char as CRLF #230
Comments
Hello. Processed file is correct. SVGO doesn’t remove |
So, should I extend the plugin to do it? I don't like these extra bytes. |
If you are 100% sure that you don’t need these entities, you may create additional Grunt task to cut them off using any “text replace” plugin. I don’t know any straight way to extend existing SVGO plugin. However, you are able to add your own plugin into the processing queue when creating new instance of the SVGO module. Something like this: var svgo = new SVGO({
full: true,
plugins: [
'removeXMLProcInst',
'removeComments',
'removeMetadata',
'removeEditorsNSData'
]
});
// remove DOCTYPE declaration completely
svgo.config.plugins.push([{
type: 'perItem',
active: true,
fn: function (item) {
if (item.doctype) {
return false;
}
}
}]); Please, bear in mind that, it’s just a sample script. |
Thanks for that. Thinking a bit more about that bytes, since they are inlined in a css file and served with compression (gzip), I think these bytes won't make a difference.. |
I'm having two issues with svgo,
first the output is adding (or not removing) the CR char.
The other is the doctype, which is not being removed.
Processed file:
Original file:
Expected:
The text was updated successfully, but these errors were encountered: