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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敟 Support/Integrate quicktemplate #190

Closed
s0kil opened this issue Feb 26, 2020 · 6 comments
Closed

馃敟 Support/Integrate quicktemplate #190

s0kil opened this issue Feb 26, 2020 · 6 comments

Comments

@s0kil
Copy link

s0kil commented Feb 26, 2020

Could you provide an example on how to integrate with quicktemplate ?

@welcome
Copy link

welcome bot commented Feb 26, 2020

Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template!

@Fenny
Copy link
Member

Fenny commented Feb 27, 2020

Hi @s0kil, quicktemplate needs to be compiled and therefor we didn't add this library to our Render function yet. I use this library myself for some web apps, the way I make it work with fiber is straightforward:

go get -u github.com/valyala/quicktemplate
go get -u github.com/valyala/quicktemplate/qtc

./templates/hello.qtpl

{% func Hello(name string) %}
	Hello, {%s name %}!
{% endfunc %}

Generate templates

go generate

./server.go

package main

import (
  "./templates"
  "github.com/gofiber/fiber"
)

func main() {
  app := fiber.New()

  app.Get("/", func(c *fiber.Ctx) {
    c.Set("Content-Type", "text/html")
    c.SendString(templates.Hello("Hello, World!"))
  })

  app.Listen(3000)
}

I hope this helps, if you have any further questions please don't hesitate to leave a comment!

@s0kil
Copy link
Author

s0kil commented Feb 27, 2020

Thank You @Fenny . Do you plan to document this?

@Fenny
Copy link
Member

Fenny commented Feb 28, 2020

@s0kil, I have no plans to document this because it's not a part of our framework.
But since there is an example in this issue, it should be no problem to find for other users.

I'm closing this issue, feel free to re-open if you have questions/suggestions!

@frederikhors
Copy link

@s0kil are you still using Fiber and quicktemplate? Can I ask you how?

@ReneWerner87
Copy link
Member

@s0kil #190 (comment) here is the instruction from fenny

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

4 participants