Closed dstpierre closed 1 year ago
Hi @dstpierre. I can work on this issue, if that's ok. Seems pretty straightforward based on your description.
that's great @Conor-Fleming let me know if you have any questions
@Conor-Fleming it would be nice if this change also brings in the CSS and logo image in a "public" directory that would be embeded as well.
For example, at this moment in templates/login.html
line 14 there's a that references the logo from https, same from
templates/partials/navbar.html
line:5.
And for the CSS it's in templates/login.html
line:8 and templates/partials/head.html
line:13.
Would be nice to create a public
directory, embed it and serve it's content. This involved changing the URL to access those resources in the html file above.
See this go doc part for how to serve content from an embed.FS
.
Let me know if you have any questions.
Cool, I'll take a stab and let you know if I need anything. Thanks for the clear direction!
I have created a public
directory and added the logo-sb-no-txt.png
& sb-app.css
files as mentioned above. Would the best place to embed this new public directory and serve these files be in the existing server.go
file? Or would you rather create a new file to do this? @dstpierre
Thanks in advance.
@Conor-Fleming yes server.go
is a good file to have the embed.FS
variable.
sorry for the delay.
@Conor-Fleming I'm doing a friendly follow-up here, I'm planning a new release and would want this issue to be available in the next CLI update.
Can you update on your status, are you still interested in tackling this one?
Please let me know, thanks.
HI @dstpierre,
Apologies, I'm going to have to let this one go for the time being. Again so sorry.
@Conor-Fleming no worries at all, thanks for confirming.
By implementing the
backend
package I discover that the//go:embed
directive works when importing external package.Since the CLI uses the
core
package to expose a fully working local dev server, it would be nice to embed the templates for the web admin UI.That way they'd be available from the CLI.
We'd use them like this in the
render.go
file:Once this is done, the
loadTemplates
inrender.go
line:20 should be changed to use thetemplFS
above. Use the theio/fs
instead ofos
toReadDir
.