w0rm / gulp-svgstore

Combine svg files into one with symbol elements
https://www.npmjs.com/package/gulp-svgstore
645 stars 33 forks source link

"viewBox → viewbox" is bad #83

Closed nicothin closed 7 years ago

nicothin commented 7 years ago

Bringing attributes to the lower case causes problems with resizing svg>use image

If the attribute viewBox is written in lowercase, the resizing of the icon does not work

w0rm commented 7 years ago

Hi @nicothin! I'm not sure what is the issue, because gulp-svgstore doesn't rename viewBox to lowercase.

nicothin commented 7 years ago

Sorry This is the fault of cheerio.

w0rm commented 7 years ago

@nicothin oh, you probably need parserOptions: { xmlMode: true } there

nicothin commented 7 years ago

@w0rm TNX!!!

francescostella commented 4 years ago

For posterity and everyone reference here how to structure the options object, based on @w0rm solution:

.pipe(cheerio({
  run: function ($) {
    $('svg').attr('style',  'display:none');
  },
  parserOptions: { xmlMode: true }
}))