sandi-js
v0.1.4
Published
Tiny HTML-driven reactive framework
Downloads
457
Maintainers
Readme
sand.JS
sand.JS — a tiny, zero-build, attribute-driven JavaScript micro-framework build by Sandip Mandal.
Add interactivity directly in HTML using s- directives. Small, audit-friendly, and friendly to server-rendered pages.
- Size goal: < 20KB gzipped
- Prefix:
s-(event shorthand@click) - No virtual DOM — direct DOM updates
- Minimal plugin API
Quick demo
<!doctype html>
<html>
<head><meta charset="utf-8"><title>sand.JS demo</title></head>
<body>
<div s-data="{ open: false, count: 0 }">
<button @click="open = !open">Toggle</button>
<div s-show="open">Hello! <span s-text="count"></span></div>
<button @click="count = count + 1">+1</button>
</div>
<!-- from CDN after publishing -->
<script src="https://unpkg.com/sand.js/dist/sand.min.js" defer></script>
</body>
</html>
## Simple counter example
```html
<div s-data="{ count: 0 }">
<button @click="count++">+1</button>
<span s-bind="textContent: count"></span>
</div>