Replies: 8 comments 13 replies
-
Hello Bosix. Thank you for your explanation. At work we deploy the static assets from our own repository. But this only works fine for very large and long-term projects. Until I read your message, I didn't have a solution for how we can make this development-friendly. Especially since many Confetti programmers do not have much experience with Go. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I think it would be nice if there is a file with all the configuration options. And that packr is turned on by default. |
Beta Was this translation helpful? Give feedback.
-
The templates should then be loaded via dependency injection, I think. Then you can also support the current situation. |
Beta Was this translation helpful? Give feedback.
-
How are css and javascript files exposed? Would you just send that via the router? |
Beta Was this translation helpful? Give feedback.
-
Go 1.16 gets embedded files if I'm not mistaken. |
Beta Was this translation helpful? Give feedback.
-
@marcelloh looks good. I suggest to wait for go 1.16 then. (I'm really not up to date with the current changes in go...) |
Beta Was this translation helpful? Give feedback.
-
@bosix @marcelloh All templates are now loaded with Pretty cool that you can put everything in 1 file. |
Beta Was this translation helpful? Give feedback.
-
Hi there :),
first of all: I love the project. Laravel is an amazing framework and the ability to use it in one of my favourite languages is really great.
"Problem"
One of the advantages of golang is that it compiles into one executable binary with all dependencies in it and so does confetti. The problem with that is that the view templates and other static files are not included in that binary so it's always necessary to ship the binary together with the resources dir (and of course the .env).
Suggestion
There are golang packages which allow adding static files into the go binary (e.g. https://github.com/gobuffalo/packr). With that, it is possible to add js/css/gohtml/png... files to a so-called "box" before actually compile the binary. All static file data is loaded as a byte array into the go application.
Notices
Use Case
When you ship an application to live the fewer files you have to touch or replace the better and easier the deployment is. If you have only one file to switch during an update, your deployment is really fast and more reliable. It's reliable because all dependencies are inside that one file and switching it will automatically update all dependencies. Additionally, If done correctly, your application is faster since requesting static files not longer require disk io.
I have to admit that you can achieve the same effect in terms of reliability if you create a docker image which included all static files already.
Beta Was this translation helpful? Give feedback.
All reactions