Skip to content

osushibui/hanayo

 
 

Repository files navigation

Hanayo

This repository has a mirror here. The original repo is still here.

To fellow developers: this is not how you do it!

The biggest flaw of hanayo are that when Ripple set out to create it, they wanted to create a template system that:

  • Created a handler by simply having the file "be there"
  • Could fetch the data it needed on its own, often from the Shibui API
  • Had the actual Go code be as little as possible

This was not immediately evident to Ripple, a Go beginner, but what Ripple did there was basically make Go be PHP.

The biggest lesson Ripple learned on how to properly do templates, was learning to use Vue. Yes, Vue can be used for the frontend and not really for server-rendered stuff, but even just learning how to do stuff with it can help you understand what a template is actually supposed to be in order to be maintainable.

The key concepts and insights for Ripple were:

  • Separating clearly code and markup, making the template declarative and keeping as little code in the template
  • A template should be purely functional. Its mere creation should not generate side effects, nor should it be dependent on things that are not its precise inputs: for a given input there is a specific output.
  • The concept of component as a single self-contained entity which is the same wherever you use it is very powerful.
  • Once a template/component starts becoming too big, split it into more components.

But don't stop here. Actually making a project using Vue helps you to understand this much more easily than using mere words. Go ahead and build something, even if just to play around!

Packages

No packages published

Languages

  • JavaScript 46.4%
  • CSS 38.7%
  • Less 8.2%
  • Go 3.1%
  • HTML 1.8%
  • Roff 1.8%