Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinshin86/img2amp-img
img to amp-img
https://github.com/shinshin86/img2amp-img
amp amp-img img img-to-amp-img img2amp-img
Last synced: 14 days ago
JSON representation
img to amp-img
- Host: GitHub
- URL: https://github.com/shinshin86/img2amp-img
- Owner: shinshin86
- License: mit
- Created: 2021-03-06T05:14:28.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-21T22:06:35.000Z (over 2 years ago)
- Last Synced: 2024-04-26T10:21:33.729Z (8 months ago)
- Topics: amp, amp-img, img, img-to-amp-img, img2amp-img
- Language: TypeScript
- Homepage:
- Size: 243 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![img2amp-img - logo](https://user-images.githubusercontent.com/8216064/111606270-63cf7680-881a-11eb-9ade-63670e7ea851.png)
# img2amp-img
[![Test](https://github.com/shinshin86/img2amp-img/actions/workflows/test.yml/badge.svg)](https://github.com/shinshin86/img2amp-img/actions/workflows/test.yml)
img to amp-img
```html
```↓
```html
```
## Install
```sh
npm install img2amp-img
# or
yarn add img2amp-img
```## Usage
```javascript
const img2AmpImg = require('img2amp-img');(async () => {
const imageTag = '';
const ampImgTag = await img2AmpImg(imageTag);
console.log(ampImgTag);
})();
```Output
```html
Width of specified image
height="100" // -> Height of specified image
layout="responsive" // -> Now it's fixed at responsive
>
```## Option
Can use the options corresponding to the layout attribute.
If no option is specified, `responsive` will be selected.
```
'responsive'
'fill'
'fixed'
'fixed-height'
'flex-item'
'intrinsic'
'nodisplay'
```For more information about the option, please refer to the official AMP website.
[\ - amp.dev](https://amp.dev/documentation/components/amp-img/)
## Licence
[MIT](https://github.com/shinshin86/img2amp-img/blob/main/LICENSE)
## Author
[Yuki Shindo](https://shinshin86.com/en)