Hi,

some major updates here,

1. much less ugly //go:generate comments. 
Rather than passing arguments to template-compiler,
you declare a configuration variable into your code,
template-compiler will locate and export it via the ast (amazing what we 
can do with it)

So now it look likes this,
//go:generate template-compiler
var compiledTemplates = compiled.New(
  "gen.go",
  []compiled.TemplateConfiguration{
    compiled.TemplateConfiguration{
      HTML:          true,
      TemplatesPath: "tmpl/*.tpl",
      Data:          TplData{},
      FuncsMap:      []string{
        "somewhere/mypackage:tplFuncs",
      },
    },
  },
)

2. lots of code re factoring, 
especially in the bootstraper and the program compiler.
rewrote tests associated too.

3. updated the demo to use html templates,
https://github.com/mh-cbon/template-compiler/blob/master/demo/gen.go#L71

4. added literature to help to understand it,
https://github.com/mh-cbon/template-compiler#understanding
https://github.com/mh-cbon/template-compiler#working-with-funcmap
https://github.com/mh-cbon/template-compiler#working-with-template-data

5. better referencing of the changes made to the std packges
https://github.com/mh-cbon/template-compiler#the-ugly-stuff

There are still work to be done, but it got much much better imho.

Hope to read more about your thoughts!

~~Happy coding!


On Saturday, January 21, 2017 at 3:58:53 PM UTC+1, mhh...@gmail.com wrote:
>
> Hi,
>
> I have been working on a package to compile go templates to regular go 
> code.
> Today i can announce an early release of it.
>
> Find it here 
> https://github.com/mh-cbon/template-compiler
>
> There is still have a lot to test and comment, 
> and to detect some edge cases.
> But the general idea and structure exists, does work,
>  and shows a way to make that happen.
>
> If you are interested to get this production ready, 
> i d like very much to see your questions and PR!
>
> Being in a hurry, this announce is very short, 
> I expect a more detailed announce later.
>
> This said, i d like to ask the go team if the template package
> could have a new structure to register a func as a template,
> see 1 
> <https://github.com/mh-cbon/template-compiler/blob/master/std/text/template/compiled.go>,
>  
> 2 
> <https://github.com/mh-cbon/template-compiler/blob/master/std/text/template/parse/compiled.go>
>  
> and 3 
> <https://github.com/mh-cbon/template-compiler/blob/master/std/text/template/exec.go#L247>
>
> Finally, i want to take chance of this message to wish
> to the golang, core team, contributors, users
> an happy new year and all the best for 2017!
>
> Happy coding!
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to