forumone / web-starter

Starting place for developing Drupal, Wordpress and other web applications
http://forumone.github.io/web-starter/
22 stars 11 forks source link

Default svgmin config removes critical attributes for IE 11 (Windows 10) #262

Closed lrobeson closed 5 years ago

lrobeson commented 7 years ago

The { removeUselessStrokeAndFill: false } part of the svgmin Grunt task config removes the width and height attributes in the path, which can cause the SVG to not render in Internet Explorer 11 (only on Windows 10, supposedly).

For example:

Original code: `ViewIcons

`

After svgmin: <svg id="icon_map" data-name="Icon Map" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 30"><defs><style>.cls-1{fill:#fff}.cls-2{fill:#63619a;fill-rule:evenodd}</style></defs><title>ViewIcons</title><path class="cls-1" d="M0 0h36v30H0z"/><path class="cls-2" d="M5.79,7.92a5.33..."/></svg>

dcmouyard commented 7 years ago

Yeah, all SVGs should have a height & width attribute in order for them to work as CSS background images.

I’m creating optional Gulp tasks for the Gesso theme which uses imagemin (svgo plugin) to minify the SVG images, which doesn’t remove the height & width attributes.