FWeinb / grunt-svgstore

Merge svgs from a folder
MIT License
920 stars 94 forks source link

Adds the preserving of for strokes (in addition to fills) #106

Closed roblevintennis closed 8 years ago

roblevintennis commented 8 years ago

@FWeinb This PR adds to currently existing behavior where currentColor is preserved for fills (I added this probably a year ago :yum: ), even if the clean array contains fill. Specifically, this PR also checks and preserves stroke.

Below you see I'm adding a stroke color from use element to achieve a second color.

screen shot 2015-11-04 at 3 18 52 pm

I ran grunt and tests passed locally

The reason we're exploring strokes at all, is that we currently control our svg icon sizes via CSS class like icon-large, icon-small, etc. What happens, is that the stroke ends up scaling in an undesirable way where we'd prefer to have the option of having it not scale. Also, it'd be nice to actually be able to leave strokes as strokes on export from the vector program ex. AI (right now we compound path everything). To achieve the "no scale" we're going to utilize Chris's idea here: http://codepen.io/chriscoyier/pen/dIlep essentially:

.no-scale {
  vector-effect: non-scaling-stroke;
}
jonathantneal commented 8 years ago

The code looks good and makes sense. Thanks, @roblevintennis!

roblevintennis commented 8 years ago

thanks @jonathantneal !