Search code examples
frameworksserver-side-renderingalpine.jsstatic-site-generation

Alpine.js it's ssr or ssg framework?


I have a question about apline.js . Sorry if it's stupid, but I didn't find answer in the off documentation. What kind of rendering does apline.js?

I understand that he doesn't have a v-dom, but I find topics about ssr rendering option on apline.js thanks for your attention.


Solution

  • Alpine.js was designed to be a client side framework as discussed in this issue [0] comment:

    Note that currently you could precompile/run Alpine.js server-side by using something like JSDOM but since Alpine.js has no virtual DOM (ie. it's tightly coupled to DOM APIs), running it outside of a DOM environment is unlikely to ever be on the roadmap.

    But there are attempts to process alpine instructions such as x-for to produce service rendered html such as described here [1] or partially implemented here [2].

    [0] https://github.com/alpinejs/alpine/discussions/551#discussioncomment-22796

    [1] https://github.com/alpinejs/alpine/discussions/596#discussioncomment-29469

    [2] https://github.com/dashpilot/alpinejs-ssr