<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icons" transform="translate(-368.000000, -426.000000)">
<g id="attention-blue" transform="translate(368.000000, 426.000000)">
<circle id="Oval-13" fill="#34C6D9" cx="10" cy="10" r="10"></circle>
<path d="M10,10.8 L10,5.6" id="Line" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M10,14.8 L10,14.8" id="Line2" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>我有两个“路径”标签的SVG图标。在使用imagemin.svgo构建之后,imagemin删除其中的一条“路径”,我的图标看起来非常糟糕。我怎么才能解决这个问题?
gimagemin.svgo({
plugins: [
{minifyStyles: false},
{ removeViewBox: false },
{ removeUselessStrokeAndFill: false },
{ cleanupIDs: false }
]
})这是我的选择。
发布于 2017-09-14 17:55:45
实际上,SVGO并没有删除第二条路径,而是将其合并到第一条路径中(默认情况下由“mergePath”插件完成)。但是,因为第二条路径的长度为零,SVGO删除了“lineto”(“L10,14.8”)命令(“convertPathData”插件就是这样做的),因此它只剩下无用的“moveto”(M10 14.8)命令。
我建议不要用这样的方式画图片。您可以使用另一个<circle>,或者用弧曲线在路径上画一个圆圈。
当然,对于这个特定的映像,您可以禁用“convertPathData”插件,但是我不推荐它作为一个普通的解决方案,因为它是基本的优化插件之一。
https://stackoverflow.com/questions/44674723
复制相似问题