-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for base64 encoded files. #58
Comments
@peacememories Hello! Ga does support bas64! :) Unfortunately, I've never used this feature and don't know how to to integrate it with Ga's asset loader. But, I don't know 🙃 Can anyone help? |
Ah I see. One workaround I thought of was to just manually inject the dependencies into the asset dict. The other variant (which would not be bad anyway, I think) could be to stop testing assets by file extension and instead fetch them and look at the mime type. One drawback I see with this is more ram usage, although I'm not sure that would be the case, and it might be worth it anyway. Elaboration on more ram usage: One could use the fetch API to fetch the url in the asset array, then test for mime types and use the createDataURL function to create a data url from the original file. This would of course mean that some assets would store the url, the data url, and the actual data somewhere, potentially doubling or tripling the memory consumption. Right now this would be worth it for me, since in cases where this memory consumption would pose problems the advantages of Ga (namely its tiny footprint) would not matter anymore and people might choose bigger engines with different asset handling. |
Also possible:
to be supplied in the array. Then allow |
@peacememories: Wow, that's interesting! I've never thought of doing that - could be amazing! If you manage to get this working, please PR :) |
Hi, and thanks for your work on this neat little engine.
I'm currently working on an entry for js13k, and using webpack with a few loaders. One of them is a base64 loader which packs required files (like images) into a data url string at compile time. This is neat because it allows me to embed everything quickly in one single html file.
Unfortunately this does not seem to work with gas asset loading. Trying to preload a data url results in the loader complaining about unsupported types.
It would be lovely to have this feature in ga. If there is already a way (even if a bit more complicated) to do this, I would love to hear it also :)
The text was updated successfully, but these errors were encountered: