-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a feature of loading templates from binary data generated by go-bindata #28
base: master
Are you sure you want to change the base?
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. |
if options.Asset != nil && options.AssetNames != nil { | ||
// Load templates from the assets (binary data). | ||
for _, path := range options.AssetNames { | ||
load(options, dir, path, t, options.Asset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/staticbin
so 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
,AssetName
onOptions
.filepath.Walk
toload
function.options.Asset
andoptions.AssetNames
are 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/render
had 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/render
middleware.Thanks.