craftyjs / Crafty

JavaScript Game Engine
http://craftyjs.com
MIT License
3.38k stars 561 forks source link

Support data-uri ? #1188

Closed chux0519 closed 5 years ago

chux0519 commented 5 years ago

It seems that Cratfy does not support data-uri encoded assets. I want to wrap all my assets (data-uri) up in one big single js file, but once using the data uri as assets' url, it doesn't work.

Simply I changed the isValidImage method of loader.js

return f.startsWith('data:') || Crafty.imageWhitelist.indexOf(getExt(f)) !== -1;

It works, but will cause very long key in Crafty.assets.

Any idea / suggestion of this ?

OhIAmFine commented 5 years ago

I also meet the questions ,can Crafty have some solution?