[ $davids.sh ] โ€” david shekunts blog

๐Ÿ‘ฉโ€๐Ÿ’ป Vue.js โ€“ A Path to a Bright Future WITHOUT Frontends ๐Ÿ‘ฉโ€๐Ÿ’ป

# [ $davids.sh ] ยท message #271

๐Ÿ‘ฉโ€๐Ÿ’ป Vue.js โ€“ A Path to a Bright Future WITHOUT Frontends ๐Ÿ‘ฉโ€๐Ÿ’ป

Yesterday during the stream, I managed to connect Vue.js logic to one of the forms rendered with Go, and this will lead to my almost complete abandonment of pure SPAs.

Find out exactly what happened in the comments.

#go #vue #js #die_spa

  • @ [ $davids.sh ] ยท # 1694

    What I did:

    1. Described a form for registration using templ (a Go templating language).
    2. Specified the necessary Vue tags within it.
    3. Described the Vue component's logic in a JS file.
    4. Linked it into the template via <script>.

    As a result, the form is rendered on the backend, and on the client-side, Vue picks it up and handles the logic itself.

    The awesomeness (and there's no other word for it) is that I can now write frontend code almost entirely in Go, adding plain JS in simple places, HTMX in templates, and describing the logic for more complex components in Vue (instead of the old-school jQuery).

    This doesn't solve all the problems that arise with user experience when working with server-side rendering, but I will continue to gradually address them.

    For example, the next thing I want to add is rendering only parts of the page (like islands in Astro's style), and for that, I'll only need HTMX.

    The question: "Why, if you can just use an SPA?" โ€“ SPAs and frontend developers have completely worn me out, and I want to find any ways to minimize their involvement in my projects.

    I'll explain what, how, and why in upcoming posts.

  • @ Dima Dorofeev ยท # 1695

    Also, Alpine.js is convenient for this, you almost don't need to write JS.

  • @ Aleksey Zhidkov ยท # 1696

    And for Vue, don't you need to set up some npm/webpack/Node and other things that make a backend developer's eye twitch? For Trainer Advisor, I chose Alpine for these reasons - just include the script and go.

    And, by the way, from my experience with TA, I can say that HTMX+Alpine can have some rough edges. When you need to put an HTMX link into an Alpine template, which will then pull in an HTML file with an Alpine template:)

  • @ [ $davids.sh ] ยท # 1697

    Let's see, thank you!

  • @ [ $davids.sh ] ยท # 1698

    I just linked the script via CDN and that's it)

  • @ [ $davids.sh ] ยท # 1699

    Watched it, great topic!

    I'll try alpine.js too

  • @ Grigoriy ITK Malyshev ยท # 1703

    So that's PHP1

  • @ [ $davids.sh ] ยท # 1704

    ?

  • @ Mr Kimura ยท # 1730

    There's another really cool framework โ€“ https://stimulus.hotwired.dev/ It also works with server-rendered HTML. I liked it much better than Alpine.

  • @ [ $davids.sh ] ยท # 1731

    Yes, an interesting thing.

    I especially want to study Turbo from them.

    The only funny thing is that Stimulus is written purely in the way Rubyists are used to: a lot of magic and naming conventions without any adequate typing capabilities. And in the end, I saw that it was made by the guys from Basecamp, where the creator of all this is a Rubyist who is famous for being a proponent of RoR and against typing.