vugu / vugu.github.io

Vugu Site on GitHub Pages
0 stars 3 forks source link

Remove "go:generate vugugen ." from example server code #4

Closed MDobak closed 4 years ago

MDobak commented 4 years ago

The documentation in section "Getting Started" encourages the user to download a simple project using vgrun -new-from-example=simple . command. This example project contains a file generate.go with this instruction //go:generate vugugen -s.

Next in section "Building and Distribution" the documentation shows the example server code with this instruction: go:generate vugugen ..

If the user follows above steps from the documentation, the go generate command will produce two conflicting files: root_vgen.go and 0_components_vgen.go.

BTW: Wouldn't it be better to replace devserver.go with server.go from the doc If both servers can work as dev servers anyway?

bradleypeabody commented 4 years ago

Thanks, this is fixed now. https://www.vugu.org/doc/build-and-dist

MDobak commented 4 years ago

@bradleypeabody Thanks! I also want to ask you, what do you think about replacing devserver.go in sample projects to server.go from the documentation? For me it was (and still is) quite confusing why there are two servers provided.

Also, maybe the dist.go from the doc should be merged with the server.go and run when the --dev flag is not specified? I think that would be very convenient to have one app to manage the whole project, especially for beginners like me ;)

bradleypeabody commented 4 years ago

@MDobak Yes, I agree. I'm working on putting together more examples of this with the various pieces integrated together. The vugu site itself https://github.com/vugu/vugu-site does some of this and server/main.go combines both the server functionality and distribution stuff.

The overall idea is that there are probably maybe half a dozen common patterns (simple one-folder SPA for prototyping, larger SPA app with different sections, static site renderer server-side, combo server-rendering plus SPA, and some other cases) and the plan is to put together examples for each and point to those in the documentation.

MDobak commented 4 years ago

Ok, thanks for the explanation! :)