Please help me understand how this emoji package works


#1

Regarding https://github.com/SeriousM/meteor-emoji/blob/master/package.js

Could someone please help me understand this package. I’d like to know whether all of the emoji images are downloaded onto the client at startup? From my understand of the package.js file, It seems they are downloaded to the client. This would be really expensive. It would make sense to me that the emoji images instead reside as public assets on the server only and are linked to by the client.

How could we change the package.js to achieve this?

Thanks


#2

The images are added as public assets and are not “sent” to the client.

The way meteor works is that html, css, and javascript are compiled. An initial html page is generated that includes the javascript and css in the head of the document. The browser then makes the request for these additional resources and the page renders… There isn’t any way for anything to be sent directly to the client without it requesting it, so anything that isn’t html, css or javascript is added at the root of the application as a public asset just as something placed in the public directory would be.


#3

That’s really neat. Thanks for breaking it down.