Skip to content

Commit

Permalink
Fix package exports and types
Browse files Browse the repository at this point in the history
  • Loading branch information
Siilwyn committed Aug 9, 2024
1 parent c1a84cd commit 9ad1316
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
6 changes: 3 additions & 3 deletions image-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"files": [
"dist"
],
"exports": "./dist/image-vue-pure/Image.mjs",
"types": "./dist/image-vue-pure/Image.d.mts",
"exports": "./dist/image-vue/Image.mjs",
"types": "./dist/image-vue/Image.d.mts",
"repository": {
"type": "git",
"url": "git+https://github.com/voorhoede/Image.git",
Expand All @@ -31,4 +31,4 @@
],
"author": "De Voorhoede (https://www.voorhoede.nl/)",
"license": "ISC"
}
}
38 changes: 38 additions & 0 deletions image-vue/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# App Image
Extension of the native `<img>` element. When loading images it is important to load assets matching the needed size, this is done using the `loader` prop and setting `sizes`.

## Usage
### Image with fixed size
```vue
<app-image
src="/example.jpg"
:width="754"
:height="552"
alt="An example"
/>
```

### Image with responsive size
```vue
<app-image
src="/example.jpg"
:width="754"
:height="552"
alt="An example"
sizes="100vw"
/>
```

### With loader
Pass `loader` function to resolve `src` to optimized URLs.
```vue
<app-image
src="/example.jpg"
:width="754"
:height="552"
alt="An example"
sizes="100vw"
:loader="({ src, width }) => `${src}?width=${width}`"
/>
```

3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Image component
Image component to fetch optimized images from a CDN.

Extension of the native `<img>` element. When loading images it is important to load assets matching the needed size, this is done using the `loader` prop and setting `sizes`.

## Niceness
- No client-side JavaScript
- Generate `srcset` from native `sizes` attribute

0 comments on commit 9ad1316

Please sign in to comment.