@zikojs/astro 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @zikojs/astro
|
|
2
|
+
|
|
3
|
+
Integrate [ZikoJS](https://github.com/zikojs/ziko) components into [Astro](https://astro.build/) applications.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Install the integration with Astro's CLI:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx astro add @zikojs/astro
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install it manually:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @zikojs/astro
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then add the integration to your `astro.config.mjs`:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { defineConfig } from "astro/config";
|
|
23
|
+
import ziko from "@zikojs/astro";
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
integrations: [ziko()],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### 1. Define a ZikoJS component
|
|
33
|
+
|
|
34
|
+
Create a ZikoJS component:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// HelloFromZikoJs.js
|
|
38
|
+
import { p } from "ziko/dom";
|
|
39
|
+
|
|
40
|
+
export default function HelloFromZikoJs({ color }) {
|
|
41
|
+
return p("Hello From ZikoJS").style({ color });
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Render the component in Astro
|
|
46
|
+
|
|
47
|
+
Import the component into an `.astro` file:
|
|
48
|
+
|
|
49
|
+
```astro
|
|
50
|
+
---
|
|
51
|
+
import HelloFromZikoJs from "./HelloFromZikoJs.js";
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
<HelloFromZikoJs
|
|
55
|
+
color="orange"
|
|
56
|
+
client:only="javascript"
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `client:only="javascript"` directive tells Astro to render the ZikoJS component exclusively on the client.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|