Possible to use as a server-side API? #596
adamquaile
started this conversation in
4. General
Replies: 1 comment 7 replies
-
It's totally out of the scope of that project, but you can use the import {render} from 'alpine-test-utils'
html = render('<div x-data="{ aa: 'foo' }"></div>', { aa: 'bar' }).outerHTML;
See https://github.com/HugoDF/alpine-test-utils#quick-start-write-your-first-test |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This might be out of scope for the project, but I'll ask anyway.
Would it be possible to use this library entirely on the server side, for prerendering content?
E.g.
For more context, I like how small the learning curve is on alpine, and I was actually thinking this could make a very nice thin wrapper around HTML, or even MJML to build emails on.
In this case an API might be required to pass extra parameters, like in traditional template languages for some of the variables.
It seems like this might be hard if no DOM actually exists on the server side, but is this possible or even a good idea?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions