Skip to content
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

c.Html(...) default suffix #54

Closed
muei opened this issue Jul 8, 2014 · 3 comments
Closed

c.Html(...) default suffix #54

muei opened this issue Jul 8, 2014 · 3 comments

Comments

@muei
Copy link

muei commented Jul 8, 2014

I hope the suffix will be defautl as ".tmpl", so I can use like c.Html(200,"index",nil) ,this will find index.tmpl, if c.Html(200,"index.html".nil) will find the index.html.
ps: i'm not a english user, so my English is very bad, please forgive me

@manucorporat
Copy link
Contributor

There are another libraries that adds a configured suffix, in my opinion it adds unneeded complexity.
An UX designed told me one day: "explicit is usually better than implicit".

I think the Go philosophy is similar, I prefer the developers to use "index.tmpl" or "index.html" or whatever the file name is, instead of adding tons of configuration variables (I can't hardcode ".tmpl") and make c.HTML(200, "index", nil) works like magic.

If you want to serve static files please use gin.Static() or use c.Writer/c.Data directly.

r := gin.Default()
r.Static("/static", "/var/www") // var/www is the root path in your local disk/volume

@muei
Copy link
Author

muei commented Jul 8, 2014

Thanks,I got it.

@manucorporat
Copy link
Contributor

I added a flexible Render system. 5ea7a92

You can create your own HTML render, with your custom settings. You can use a different html templating engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants