minifyStyles
Default
Minify <style> elements with CSSO.
Usage
- Basic
- Parameters
svgo.config.js
module.exports = {
plugins: [
"minifyStyles"
]
}
svgo.config.js
module.exports = {
plugins: [
{
name: "minifyStyles",
params: {
usage: true
}
}
]
}
Parameters
usageIf to collect usage data such as tags, classes, and IDs to pass to CSSO. This is an object with four properties, which are each configured with a boolean,
tags,ids,classes, andforce. By default, if a script is found this does not pass usage data to CSSO, but this can be overridden withforce, which may yield destructive changes.
Demo
Live Editor
const svg = ` <?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox=" 0 0 150 100 " width="150"> <!-- Created with love! --> <defs> <ellipse cx="50" cy="50.0" rx="50.00" ry="auto" fill="black" id="circle"/> </defs> <g> <use href="/?originalUrl=https%3A%2F%2Fsvgo.dev%2F%26quot%3B%23circle%26quot%3B%2520transform%3D%26quot%3BskewX(16)%26quot%3B%2F"> <rect id="useless" width="0" height="0" fill="#ff0000"/> </g> </svg> `; const svgoConfig = { js2svg: { indent: 2, pretty: true }, plugins: [ "minifyStyles" ] } render(<SvgoPreview svg={svg} svgoConfig={svgoConfig}/>);
Result
Loading...