DEV Community

Discussion on: Vecty with Vue.js style templating

Collapse
athif23 profile image
At Indo

I mean, vue have this file extension '.vue' where you can write raw HTML in it and it will be auto-compiled to javascript syntax with the help of webpack or browserify. So, why not make one too in GO? It will be much easier to see, than seeing the HTML wrapped with the single quote. Maybe like '.gox' or something?
Thanks.

Thread Thread
progrium profile image
Jeff Lindsay Author

Oh, yes. Actually a project that does JSX style Go exists (and uses .gox), but the reason I don't like this is that it's more complex and will pollute your files with .go and .gox files. This might be acceptable for JavaScript project, but I don't find it acceptable. What's more common in Go is to have separate template files, and that's easy to do here.

With Vecty if the HTML for a component is simple enough to not warrant a separate file then you can use the functional builder API that it currently comes with.

Thread Thread
norunners profile image
norunners

Check out vueg which uses go generate to achieve this.
github.com/norunners/vueg