joypixels / emojione

[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
https://www.joypixels.com
Other
4.46k stars 533 forks source link

3.1 emoji assets aren't available on jsdelivr #525

Closed mattlewis92 closed 7 years ago

mattlewis92 commented 7 years ago

For example: https://cdn.jsdelivr.net/emojione/assets/3.1/png/1f1ee-1f1f8.png

caseyahenson commented 7 years ago

To access the assets via cdn you'll need to include one of the available png sizes (32, 64, 128) in the url like: https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f1ee-1f1f8.png.

mattlewis92 commented 7 years ago

Sorry I should have been a bit more specific, the JS code assumes a default of 32 pixels and so doesn't add it to the urls it generates: https://github.com/emojione/emojione/blob/master/lib/js/emojione.js#L262

caseyahenson commented 7 years ago

@mattlewis92 thanks for clarifying and pointing this out, I'll adjust the logic here and get a patch out soon.

rshk commented 7 years ago

I just noticed this behavior in the library version 3.1. It also looks like the emojiSize option is ignored, as well as defaultPathPNG, making it unusable (?!) as all the generated point to a broken link..

Looking at the code, I was wondering what's the reason for this:

ePath = (ns.emojiSize !== '32') ? ns.defaultPathPNG + ns.emojiSize + '/' : ns.imagePathPNG

rather than simply:

ePath = ns.defaultPathPNG + ns.emojiSize + '/'
caseyahenson commented 7 years ago

This should be fixed in the 3.1.1 release. @rshk the logic for that should be a little more clear now, the reasoning being that we want the user to be able to define an emoji size to fetch from the CDN path, but if the user is fetching the images locally from a directory with no size indicated, the size parameter could conflict with the local path. Now indicating an image path other than the default CDN path simply overwrites the original image path and the image size parameter.