Set root URL for resources on html5 backend

In project.xml I add my resources directory:

<assets path="resources">

and if I run my app at /index.html, it’ll request resources from /resources/.

But I run into an issue if I want to store several copies of the app at the single server.
Let’s say I host the following:


and either of app.js can embedded into /index.html. In this case, app.js will still request resources from /resources/ and it’ll fail with 404.

So, is there any way to make app.js request resources relative to some custom path such as /app/1.0/ when I initialize it with lime.embed?

Ah, this is a good idea for improvement. Would you mind making an issue on I’ll try and make time to make this improvement soon. Thank you! :slight_smile:

It’s possible I can contribute this change faster if we agree on how to implement this.
Do you think it should be an extra argument to lime.embed or something different?
Or should I move this whole discussion to github?

A part of me considers doing it as another argument, but another part of me wonders if we’ll have another things we want to do to customize it, and we keep (perpetually) adding arguments when (at some point) we should have done some kind of “options” object.

Do you embed more than one project on the same page? That’s a scenario I’d be happy to see supported better, I haven’t really tried to wrap my mind around that entirely, not sure if there’s something to be done to support embedding by project ID, for example (like:

lime.embed ("", "content", 500, 400);


lime.embed ("project2.js", "content", 500, 400);

If the data is passed in, say as another argument, or an options object (like { root: "path/to/root" }), I think the primary place to store this data would perhaps be in the object, either as another property, or a more generic Dynamic object attached to it.

Then the “dirty” solution would be to edit lime/templates/haxe/DefaultAssetLibrary.hx, and about line 52 (in the #if html5 block, to check ApplicationMain.config.root or or whatever it ends up being. Then when all the paths are set, it could be root + whatever it is normally (whether the root is an empty string, or something additional)

I’ll keep thinking about it, but this is the general way I think it could be done

I would also like to vote-up this idea, as in my case. Let say I have multiple games and every game is a new html file (mission1.html … mission17.html), then these game points to their respective js files.

Therefore what I do is keeps html file in a common “games” folder then keeping all the related js files in a seprate folder “inc/mission17/all js here”

Then manually search and replace all the paths in “.js” files.

Right now all games have different mechanics.

I’ve posted two PRs to github: