trunk icon indicating copy to clipboard operation
trunk copied to clipboard

Add configuration for a url postfix and html output filename

Open mmarklar opened this issue 1 year ago • 1 comments
trafficstars

I'm using trunk to build a project that is served from Django. It builds everything perfectly but there are two things that would make the process of using the outputs easier. I'm going to add them in but I wanted to post here and see if it's something you would like contributed. Not sure but I think these changes will help with other environments as well.

  • To integrate with how Django templates link to files, the urls need to be formatted like "{% static 'file' %}". Prepending {% static is achievable with the public_url config, but the closing %} would require a new config. I'll probably call it url_postfix.
  • Because this is not the root of the site, I'd like to have the html file named something other than index.html. As far as I can tell you can set the source template file name but not the output name. I'd like to add a config, probably called html_output or something similar.

Thanks for the project, let me know what you think!

mmarklar avatar Jun 20 '24 15:06 mmarklar

Changing the output filename sounds reasonable and simple. That should be a quick PR.

I am not sure about the URL processing with Django. It feels quite specific and having some string concatenation like that feels quite fragile.

As I don't know the background, I am not sure I have a better idea. Maybe it makes sense to have some "URL template", which allows specifying the full "format" instead?

But maybe it would be better to do some post-processing with a hook instead.

ctron avatar Jun 24 '24 09:06 ctron