@lonik/oh-image 1.2.2 → 1.2.3
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 +2 -0
- package/dist/README.md +42 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Oh Image
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@lonik/oh-image)
|
|
4
|
+
|
|
5
|
+
The missing `<Image />` component for Vite and React.
|
|
6
|
+
|
|
7
|
+
For full documentation, visit [docs](https://lukonik.github.io/oh-image).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @lonik/oh-image sharp --save
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### 1. Register the Vite plugin
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// vite.config.ts
|
|
21
|
+
import { defineConfig } from "vite";
|
|
22
|
+
import react from "@vitejs/plugin-react";
|
|
23
|
+
import { ohImage } from "@lonik/oh-image/plugin";
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
plugins: [react(), ohImage()],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. Use the Image component
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Image } from "@lonik/oh-image/react";
|
|
34
|
+
import heroImg from "./hero.jpg?oh";
|
|
35
|
+
|
|
36
|
+
function App() {
|
|
37
|
+
return <Image src={heroImg} alt="Hero" />;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
[MIT](./LICENSE)
|
package/package.json
CHANGED