Cleanup Attributes Default
Removes redundant whitespaces from attribute values.
This will not modify the attribute keys, nor remove them if the value becomes empty after optimization.
Usage
js
module.exports = {
plugins: ["cleanupAttrs"],
};
module.exports = {
plugins: ["cleanupAttrs"],
};
Parameters
newlines
Replace instances of a newline with a single whitespace.trim
Trim whitespace characters from the start and end of attribute values.spaces
Replace all instances of 2 or more whitespace characters with a single whitespace.Usage example
js
module.exports = {
plugins: [
{
name: "cleanupAttrs",
params: {
newlines: true,
trim: true,
spaces: true
}
}
]
}
module.exports = {
plugins: [
{
name: "cleanupAttrs",
params: {
newlines: true,
trim: true,
spaces: true
}
}
]
}
Demo
Implementation
https://github.com/svg/svgo/blob/main/plugins/cleanupAttrs.js