Add a feature of loading templates from binary data generated by go-bindata#28
Add a feature of loading templates from binary data generated by go-bindata#28yosssi wants to merge 4 commits intomartini-contrib:masterfrom
Conversation
|
Hi Yosssi, I just added support for martini-contrib/staticbin to martini-contrib/render (https://github.com/hypebeast/render). Unfortunately, I didn't check the open pull requests for render and overlooked your work. I tested your fork and it works quite well for me. Great work and thanks for the great staticbin library. |
render.go
Outdated
There was a problem hiding this comment.
Maybe, it's a good idea to check if the asset is actually a template. Otherwise, non template files with the same extension as the templates gets compiled, too. It should be enough to check if the asset is part of the templates directory. Something like that:
if strings.HasPrefix(path, dir) {
load(options, dir, path, t, options.Asset)
}|
Hi @hypebeast, Thanks for your comment and reviewing!
Oh, you are right and I didn't notice that! I fixed it. Thanks for your valuable advice! Hope that this PR will be merged and we will be able to use this feature soon. |
|
I hope it to :) |
|
👍 |
|
👍 |
|
@pboehm @donovanhide Thanks! |
|
👍 merge please :D |
I added a feature of loading templates from binary data generated by go-bindata.
I created
martini-contrib/staticbinso that Martini can serve static files from binary data.By adding this feature on
martini-contrib/render, a web application using Martini can be compiled into a single binary file completely.I would be glad if you could merge this PR.
[Changes]
Asset,AssetNameonOptions.filepath.Walktoloadfunction.options.Assetandoptions.AssetNamesare set, load templates from binary data. Otherwise, load templates from files as before.I thought of creating a new middleware which has this feature. But
martini-contrib/renderhad various important features and I thought it was not good idea to create a new middleware similar to this one, so I decided to add this feature on the existingmartini-contrib/rendermiddleware.Thanks.