36 lines
No EOL
2.2 KiB
Markdown
36 lines
No EOL
2.2 KiB
Markdown
# 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 the html tag.
|
|
|
|
| attrib | description | default | module |
|
|
| -------------------- | ----------------------------------------------------- | --------------- | ------ |
|
|
| `x0-mods` | what modules to include | nothing | x0 |
|
|
| `x0-module-root` | where to fetch the modules from | `./x0/modules/` | x0 |
|
|
| `x0-init` | init x0? | `true` | x0 |
|
|
| `x0-locale-file` | which locale file to use | nothing | locale |
|
|
| `x0-locale-watch` | add an onchange listener to update locales | | locale |
|
|
| `x0-locale-no-cache` | do **not** use cached locales | | locale |
|
|
| `x0-locale-default` | default locale | `en` | locale |
|
|
| `x0-locale-prefer` | set a preferred locale; ignore users lang if possible | | locale |
|
|
|
|
### 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"` |
|
|
| locale | `x-locale-key` | fetch locale key and put it in innerHTML | `x-locale-key="main.greeting"` | |