英文:
Including template files in Go executable
问题
我想解析一个模板HTML文件夹,并在构建时将它们缓存(或缓冲),以便在以后的Web项目中使用。基本上,我试图做的是,当我构建我的项目时,我不需要将HTML文件与可执行文件一起上传。
英文:
I want to parse a folder of template HTML files and cache (or buffer) them on build for later use in a web project. Basically I am trying to make it so when I build my project I dont need to take the HTML files with me when I upload the executable file.
答案1
得分: 2
我认为你可能在谈论将HTML文件嵌入到二进制文件中?
如果是这样,到目前为止我见过的最好的方法是使用camlistore的fileembed:https://code.google.com/p/camlistore/source/browse/pkg/fileembed/fileembed.go
在这里可以找到使用说明:https://groups.google.com/d/msg/golang-nuts/LQMv7Zsmsi0/8Aax1XSekjAJ
该线程还提供了其他用于此目的的包的附加信息。
英文:
I think maybe you are talking about embedding the html files in your binary?
If so the best way to do this that I've seen so far has been camlistores fileembed: https://code.google.com/p/camlistore/source/browse/pkg/fileembed/fileembed.go
See here for directions on use: https://groups.google.com/d/msg/golang-nuts/LQMv7Zsmsi0/8Aax1XSekjAJ
That thread has addtional info on other packages for this as well.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论