#Custom Tags

9 messages · Page 1 of 1 (latest)

wraith snow
#

there is no such feature yet, you can request one on the Github

#

you maybe can provide more information like what are you going to do with the script, there might be other solutions than pass the whole tag as the string

zenith summit
#

Custom Tags

#

Eh- I'll continue with the function route, I think I don't need a custom tag really for this~

#

ty though- just wanted to know if there was a better Go solution

gentle vapor
#

Please, do not delete the original post. It's good to see what the question and the conclusion was.

prisma ploverBOT
#

If your question has been solved, please close the thread with </solved:1022173889255706726>

zenith summit
#

Sorry; the original question was just if GoLang had some way to "re-write" or do custom tags in html/template.

The use case I was after was to allow something like:

{{define "css"}
body {
  background: aqua;
}
{{end}}

And then via processing, this would be minified/dropped into a static directory rather than embedded into the template. As a means to split over-rides or page specific CSS and leverage CDN

#

The end solution, is I remembered you can parse as much as you want, and subsequent parses overwrite.

After loading the actual templates, at the end of the handler I use template.Lookup().Tree.Root.String() to fetch the block content if present.

I then generate my overwrite, and programatically template.Parse() to overwrite the original block with the transformed value