x0/README.md

30 lines
1.4 KiB
Markdown
Raw Normal View History

2023-12-24 00:32:43 +01:00
# x0
A web framework for *lazy* developers.
## What can it do?
It has some attributes that simplify stuff with js.
## Attributes
### Top level attributes
These attributes only work on, and modify the root element (query selector: `html`).
| attrib | description | default |
| ---------------- | ------------------------------- | --------------- |
| `x0-mods` | what modules to include | nothing |
| `x0-module-root` | where to fetch the modules from | `./x0/modules/` |
| `x0-init` | init x0? | `true` |
### Element Attributes
Attributes you can use
| module | attrib | description | example |
| --------- | ---------------- | ----------------------------------------------------------- | ------------------------- |
| http | `x-get` | set the element's contents to the result of the get request | `x-get="./content"` |
| http | `x-get-interval` | use with `x-get` to poll the endpoint (millis) | `x-get-interval=1000` |
| http,copy | `x-inner-html` | instead of using innerHTML use innerText | `x-inner-html` |
| copy | `x-copy-query` | copy contents of element matching query selector | `x-copy-query="#content"` |