sablierapp / sablier

Start your containers on demand, shut them down automatically when there's no activity. Docker, Docker Swarm Mode and Kubernetes compatible.
https://sablierapp.dev/
GNU Affero General Public License v3.0
1.46k stars 48 forks source link

Allow templates to use external ressources (css/imgs). #415

Open ArKam opened 1 month ago

ArKam commented 1 month ago

Describe the bug I was working on a template that I would like to contribute to you and find out that all ressources needs to be embedded onto the html page itself.

Althrough it's doable, it would make that page almost unreadable as the CSS part for this page is rather lengthy.

Context

Expected behavior The template renderer should have another css/imgs handler and allow for those ressources to be imported instead of embedded.

Additional context I use a pretty standard structure with theme.html page and css/index.css and imgs/logo.png + imgs/favicon.png

Let me know if you need further informations such as a public copy of the theme etc.

acouvreur commented 1 month ago

It is not possible to load files from local path as is.

Given how themes are loaded into Sablier and then rendered, Sablier won't expose static resources.

However, Sablier could embed those files at loading time.

Creating a single HTML file with the JS and CSS.

That's something that makes sense to me, what do you think?

ArKam commented 1 month ago

Hi Alexis, From a code standpoint, goTemplate and embed could load them if an new handler is added, however I can see the troubles that such thing can bring to sablier.

If I correctly understand your idea, we still continue to bring the html/css/imgs and then have sablier will create a bundeled single page at loading time right? If so yes that would make sense to me.

Another approach that you could leverage would be the same as the one taken by traefik error page middleware that indeed leverage external services to host the pages.

Exemple: image

I'm fine with both ideas :D

acouvreur commented 1 month ago

Hey @ArKam, I just wanted to let you know that I've released https://editor.sablierapp.dev/

However, no news for embedded assets support

ArKam commented 1 month ago

oh cool! I’ll pass my theme on it and see how it goes with the online editor!