MMF-FE / svgicon

SVG icon components and tool set
https://mmf-fe.github.io/svgicon
MIT License
922 stars 95 forks source link

Svg "fill" and can't be overwritter in css anymore #84

Closed MadReal closed 5 years ago

MadReal commented 5 years ago

Before

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
  <defs>
    <style>
      .cls-1 {
        fill: #d9d9d9;
        fill-rule: evenodd;
      }
    </style>
  </defs>
  <g id="ic_ac_unit" transform="translate(-655 -494)">
    <path id="Icon" class="cls-1" d="M425-56h-4.17l3.24-3.24-1.41-1.42L418-56h-2v-2l4.66-4.66-1.42-1.41L416-60.83V-65h-2v4.17l-3.24-3.24-1.42,1.41L414-58v2h-2l-4.66-4.66-1.41,1.42L409.17-56H405v2h4.17l-3.24,3.24,1.41,1.42L412-54h2v2l-4.66,4.66,1.42,1.41L414-49.17V-45h2v-4.17l3.24,3.24,1.42-1.41L416-52v-2h2l4.66,4.66,1.41-1.42L420.83-54H425Z" transform="translate(250 559)"/>
  </g>
</svg>

After

/* eslint-disable */
/* tslint:disable */
// @ts-ignore
import icon from 'vue-svgicon'
icon.register({
  'ac_unit': {
    width: 16,
    height: 16,
    viewBox: '0 0 20 20',
    data: '<path pid="0" d="M20 9h-4.17l3.24-3.24-1.41-1.42L13 9h-2V7l4.66-4.66L14.24.93 11 4.17V0H9v4.17L5.76.93 4.34 2.34 9 7v2H7L2.34 4.34.93 5.76 4.17 9H0v2h4.17L.93 14.24l1.41 1.42L7 11h2v2l-4.66 4.66 1.42 1.41L9 15.83V20h2v-4.17l3.24 3.24 1.42-1.41L11 13v-2h2l4.66 4.66 1.41-1.42L15.83 11H20z" _fill="#d9d9d9" fill-rule="evenodd"/>'
  }
})

Now all icons are white and my color overrides in css are ignored

Allenice commented 5 years ago

The fill attr is removed by svgo. There are no fill attr in SVG.

catch6 commented 5 years ago

me too. After the upgrade, the icon color has changed. I have to modify the code and hope to return to the previous version.

chasegiunta commented 5 years ago

Same issue after upgrade. Not sure what you mean @Allenice - fill attr is definitely in SVG...?

tcasey commented 5 years ago

Same issue here. Has anyone found the last version that this worked in?

chasegiunta commented 5 years ago

@tcasey I believe 3.2.2 - I've reverted to that for now.

Allenice commented 5 years ago

This is due to the default value of the isOriginalDefault option. Thanks @philippe-tellier https://github.com/MMF-FE/vue-svgicon/pull/86. It will be fixed in v3.2.5