Closed ndarilek closed 3 years ago
It would seem that you are looking for this: https://trunkrs.dev/assets/#directives
Let me know if that works for you.
Possibly, I'm confused by the docs. I have:
<basedata-trunk-public-url/>`
in my <head/>
, but I still can't get URLs of the form
href="index..."
. What am I missing?
Thanks.
Hmm. Maybe just a typo in your response (which appears to have been via email), but if your base
element is formed as <basedata-trunk-public-url/>
(notice the missing space), then that will indeed not work. It will need to be <base data-trunk-public-url/>
. Please confirm.
Odd, definitely not that way in my Sent folder. :(
IN any case, you can see my full file in context here:
https://github.com/ndarilek/rampage/blob/main/index.html#L6
Here's the line that generates my dist/:
https://github.com/ndarilek/rampage/blob/main/Makefile.toml#L13
And the result is hosted here:
https://thewordnerd.itch.io/rampage
In particular, this snippet from the HTML that embeds the index.html into the game page:
src="//v6p9d9t4.ssl.hwcdn.net/html/3609377-381197/index.html"
Running the script as is gives:
Tacking --public-url "." onto that gives:
So now "/./", but Itch is putting my stuff at a build-specific URL, so I really need relative URLs. I.e.:
Am I misunderstanding the directive docs? It isn't clear to me if I need to fill out the attribute in lieu of --public-url, if that tells Trunk to use --public-url exactly, etc.
Thanks for your help.
It isn't clear to me if I need to fill out the attribute in lieu of --public-url, if that tells Trunk to use --public-url exactly, etc.
So, public-url
always defaults to /
if not specified. If you set it to ""
(empty string), then Trunk will remove any prefix path for your resources in the HTML. Sounds to me like that is what you want.
I'm sorry, I can't confirm that.
--public-url '' produces URLs of them form /''/index...
--public-url "" produces URLs of the form //index...
No --public-url, of course, gives me /.
Which combination am I missing? I'm on Windows FWIW, haven't investigated what CI under Linux may be doing.
Thanks.
@ndarilek hey there. Just wanted to see if this is still an issue for you, and find out what needs to be done to resolve the issue. If everything is g2g, mind closing?
I believe I did ultimately get this working, but had to shelve web support because I couldn't get all necessary features working there. It's been a hectic past few weeks so don't remember for certain. :) Thanks, I'll re-open if this issue appears again.
Passing --public-url=""
on the command line ends up prefixing all my assets in the final dist/index.html
with two /
, instead of clearing the one.
Hey, not sure if this is supported, but I've tried a bunch of ways and failed. I'm trying to publish a game to itch.io, and am getting 403s/404s for my assets. I notice that Trunk prepends / to all asset URLs, regardless of what I pass to
--public-url
. I suspect I need it to generate relative URLs to the Itch loader can find my assets.I'd expect
--public-url .
or--public-url ""
to achieve this, but nothing gets rid of the initial /. Am I missing something?Thanks.