Skip to content

Instantly share code, notes, and snippets.

@sunfmin
Last active October 4, 2021 14:54
Show Gist options
  • Save sunfmin/df5743eb317bad2f9bf7726b23721d4b to your computer and use it in GitHub Desktop.
Save sunfmin/df5743eb317bad2f9bf7726b23721d4b to your computer and use it in GitHub Desktop.
  • It all starts with https://github.com/theplant/htmlgo

    • Typesafe, Compiled
    • Extract a go func become a component natually
    • Refactor very easy
    • Looks very html
  • It's crazy that we have all these backend template languages around: go template, mustache, jinja2, Laravel Blade...

    • Normally interpreted, Not type safe, error only appear on runtime
    • File based, your program/parser have to know the path of these template files, enormous amout of bugs created because of this.
    • Yet another language to learn, you forgot how to use it after a few months
    • For separation of view and data?
  • Controller, Action, View is not a natual abstraction for web dev, So I changed it to Page, Event, Component with https://github.com/goplaid/web

    • Page, well, is a web page, mainly render a bunch of html
    • Event is the interactions you do on the Page, click a button/link, save a form, etc.
      • The result could be reload a page? update part of the page? go to another page? go to another page with pjax (PushState + AJAX)?
      • Event natually fit with AJAX
    • Component is what used to compose a Page, a div, a button is a component. a VDialog (from vuetify) is also a component
  • Then I want to feature rich component library, I don't want to and can't write it myself. Luckly I find Vuetify

    • Vue can initialize components from server side rendered html, It's perfect fit
    • Vuetify is best in class material design for vue
    • I wrote a script that generate from Vuetify API to go source code, works perfect: github.com/goplaid/x/vuetify
  • OK, Now I have the tools that I can rewrite QOR3 to QOR5

    • All the vuetify components can be used easily inside QOR5
    • Extending a editing component should be as easy as create a go func
      • We can see how easy it is to create a media box/media library and plug it in to QOR5
  • What's wrong with QOR3

    • inherited from template language, it's dependant on path of templates, and runtime template error often happens
    • the put a template into a certain path to replace the component is very error prone, hard to debug, don't know that data I can use in the template
    • jQuery and Plain Javascript is quite hard to create modulized and maintainable frontend code
    • the code base itself is hard to understand, errors are not handled well, our developers don't want to maintain it, it's a pile of code that are not liked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment