3 ms·
But they're both framework-agnostic. This snippet works with any framework and any build step. <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js
by ethmarks 11mo ago
But they're both framework-agnostic.
This snippet works with any framework and any build step.
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
<div x-data="{
today: new Date().toDateString(),
randomNum: Math.floor(Math.random() \* 100)
}">
<p>Today is <span x-text="today"></span></p>
<p>Random number: <span x-text="randomNum"></span></p>
</div>
I'll concede that Alpine.js is harder to understand and more verbose than Marko's syntax, but in order to use Marko you have to commit to the Marko framework. If you're willing to choose a framework solely for its JS-in-HTML capabilities, there are much better choices (like SvelteKit that handles JS-in-HTML wonderfully).
- ffsm8 11mo agoFwiw, Marko predates svelte quiet significantly. It was originally created by eBay iirc, back in 2014 or so. It's syntax was even stranger back then, like writing "h1.myClass my header" to create a <h1 classes=myClass>my header</h1> and similar