gavro / gulp-iconify

'A mystical CSS icon solution', grunticon-like build system.
MIT License
50 stars 22 forks source link

Make generated svg css compatible with grunticon embed #5

Closed bkastl closed 9 years ago

bkastl commented 9 years ago

The generated svg css files are not compatible with grunticons embed option. By switching the decoding they can be embedded by the grunticon javascript loader (data-grunticon-embed).

Compatibility tested in firefox, chrome, safari and ie11.

gavro commented 9 years ago

We'll need to make sure the file is really us-ascii encoded. See PR: https://github.com/gavro/gulp-iconify/pull/4

So we will need to add the string replace functions from svg-uri-encoder as well, see: https://github.com/filamentgroup/directory-encoder/blob/master/lib/svg-uri-encoder.js

bkastl commented 9 years ago

Didn't happen in my testcase because files where preprocessed by svgo. Will look at it.

gavro commented 9 years ago

Perhaps this PR is fine. Can't seem to find a testcase which breaks it :+1: (probably because all SVGs are passed through svgo (in the same normalizeSVGs callback).

Can you think of any use-cases where a faulty char might slip through?

bkastl commented 9 years ago

Well, I've found a edge case: if you are using a svg with a text node that has spaces / tabs inside, the generated svg will be invalid.

Rest works fine.

Will look at it tomorrow. Closing for now.