admin 管理员组

文章数量: 1086019

I just want to know whether is it possible to change stroke-width of svg using .svgrrc file since we can change stroke and fill property.
I tried to change but it didn't work. .svgrrc:

{
    "replaceAttrValues": {
        "#000": "{props.fill}",
        "#001": "{props.stroke}",
        "1px": "{props.strokeWidth}"
    }
}

.svg

<svg xmlns="; viewBox="0 -960 960 960" preserveAspectRatio="xMidYMid meet"
    fill="none">
    <path
        d="M381.54-350.77q-95.92 0-162.58-66.65-66.65-66.66-66.65-162.58 0-95.92 66.65-162.58 66.66-66.65 162.58-66.65 95.92 0 162.58 66.65 66.65 66.66 66.65 162.58 0 41.69-14.77 80.69t-38.77 66.69l236.31 236.31q5.61 5.62 6 13.77.38 8.16-6 14.54-6.39 6.38-14.16 6.38-7.76 0-14.15-6.38L528.92-404.31q-30 25.54-69 39.54t-78.38 14Zm0-40q79.61 0 134.42-54.81 54.81-54.8 54.81-134.42 0-79.62-54.81-134.42-54.81-54.81-134.42-54.81-79.62 0-134.42 54.81-54.81 54.8-54.81 134.42 0 79.62 54.81 134.42 54.8 54.81 134.42 54.81Z"
        fill="#000"
        stroke="#001"
        stroke-width="1px"
    />
</svg>

I just want to know whether is it possible to change stroke-width of svg using .svgrrc file since we can change stroke and fill property.
I tried to change but it didn't work. .svgrrc:

{
    "replaceAttrValues": {
        "#000": "{props.fill}",
        "#001": "{props.stroke}",
        "1px": "{props.strokeWidth}"
    }
}

.svg

<svg xmlns="http://www.w3./2000/svg" viewBox="0 -960 960 960" preserveAspectRatio="xMidYMid meet"
    fill="none">
    <path
        d="M381.54-350.77q-95.92 0-162.58-66.65-66.65-66.66-66.65-162.58 0-95.92 66.65-162.58 66.66-66.65 162.58-66.65 95.92 0 162.58 66.65 66.65 66.66 66.65 162.58 0 41.69-14.77 80.69t-38.77 66.69l236.31 236.31q5.61 5.62 6 13.77.38 8.16-6 14.54-6.39 6.38-14.16 6.38-7.76 0-14.15-6.38L528.92-404.31q-30 25.54-69 39.54t-78.38 14Zm0-40q79.61 0 134.42-54.81 54.81-54.8 54.81-134.42 0-79.62-54.81-134.42-54.81-54.81-134.42-54.81-79.62 0-134.42 54.81-54.81 54.8-54.81 134.42 0 79.62 54.81 134.42 54.8 54.81 134.42 54.81Z"
        fill="#000"
        stroke="#001"
        stroke-width="1px"
    />
</svg>
Share Improve this question asked Mar 30 at 8:40 Sagar MandalSagar Mandal 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Change stroke-width="1px" to stroke-width="1". The px is not needed

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)