itgalaxy / favicons

Favicons generator for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add SVG support

haydenbleasel opened this issue · comments

SVG support can be easily implemented if we find a pure-JS Node library that handles SVG to PNG conversion with no external dependencies.

What about librsvg?

@cloud-walker It relies on the librsvg package from Brew / Yum / Apt-Get. The solution needs to be 100% JS. Good find though, probably the closest solution thus far.

No luck so far :(

Would installing optional (native) dependencies be acceptable?

@langri-sha possibly, what do you have in mind?

Well, 2gis/node-rsvg seems to hit home pretty close, in the here and now. Would it be acceptable to add it as a optional dependency and perform a runtime check when a SVG asset is provided?

I'm just assuming there is a sizable portion of users which already have their logo vectors provided in SVG, who are then exporting a PNG to be able to use the package and if perhaps compromising with an optional dependency might be permissive.

@langri-sha I love the look of that module but it definitely requires the native deps. I want to compromise but Google's planning on using this for WSK and their main issue was with native deps. Plus, I'm aiming for a pure JS build system hence the switch to Jimp.

Documented in the README for now, we'll come back to this when possible.

Update: If you're using Gulp, you can pipe from svg2png for now.

Why is a pure JavaScript solution for SVG rendering required?
Isn't this a build tool and usually run on nodejs (with bindings)?

Weird thing, in my machine Ubuntu 15.10 with Node 6.6.0 e npm 3.10.3 it works when I use an SVG image.
But, at my server machine (in the cloud) it does not work. The server machine is a Ubuntu 14.04 with Node 6.6.0 and npm 3.10.3.

The only diff between these machines is the Ubuntu version.
You guys have any ideia why this happens?

@haydenbleasel: Native JavaScript SVG solution, seems also be usable with nodejs (server side): https://github.com/canvg/canvg - so this would finally be possible 😄 .

@strarsis you would need node-canvas for that, which uses native package cairo

What about sharp?

Most modern 64-bit OS X, Windows and Linux (glibc) systems running Node versions 4, 6, 8 and 10 do not require any additional install or runtime dependencies.

@Hypnosphi It appears that as of #221 Sharp is now used.

So if sharp is now used, what is the status of

Why are you missing certain favicons?