Skip to content

Commit d4a1d9d

Browse files
Updated README and package.json.
1 parent 0825a85 commit d4a1d9d

File tree

2 files changed

+76
-60
lines changed

2 files changed

+76
-60
lines changed

README.md

+26-13
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,41 @@
33
> Compression and conversion of images for gulp using [sharp](https://www.npmjs.com/package/sharp).
44
55
## What is this
6+
67
### With this thing you can: <br>
8+
79
- Optimize your images.
810
- Convert your images to other formats (including, but not limited to `.webp` and `.avif`).
11+
912
### Features
13+
1014
- Using the [sharp](https://www.npmjs.com/package/sharp) plugin.
1115
- Has a minimum of dependencies.
12-
- Supported formats: `.gif .png .jpg/jpeg .webp .avif .tiff .heif`
16+
- Supported formats: `.png .jpg/jpeg .webp .avif .tiff .heif .gif`
1317

1418
## Why is this
1519

1620
- [imagemin](https://www.npmjs.com/package/imagemin) is unmaintained, [see the issue](https://github.com/imagemin/imagemin/issues/385).
1721
- [gulp-libsquoosh](https://www.npmjs.com/package/gulp-libsquoosh) uses the outdated library [@squoosh/lib](https://www.npmjs.com/package/@squoosh/lib), which does not have support for node > 16.0.0. In addition, the squoosh lib is no longer maintained.
1822
- [@donmahallem/gulp-sharp](https://www.npmjs.com/package/@donmahallem/gulp-sharp) does not have normal documentation.
19-
- I have not found a single plugin that would simultaneously allow you to use the [sharp library](https://www.npmjs.com/package/sharp), convert and optimize images.
20-
2123

2224
## How to use this
25+
2326
### Installation
2427

2528
```sh
2629
$ npm install --D gulp-sharp-optimize-images
2730
```
2831

29-
### Example
32+
### Example of usage
3033

3134
```js
32-
import sharpOptimizeImages from 'gulp-sharp-optimize-images'
33-
import gulp from 'gulp'
35+
import sharpOptimizeImages from "gulp-sharp-optimize-images";
36+
import gulp from "gulp";
3437

3538
export function yourImages() {
36-
return gulp.src('yourSrcImagePath')
39+
return gulp
40+
.src("yourSrcImagePath")
3741
.pipe(
3842
sharpOptimizeImages({
3943
webp: {
@@ -45,20 +49,24 @@ export function yourImages() {
4549
lossless: true,
4650
effort: 4,
4751
},
48-
png_to_heif: {
52+
jpg_to_heif: {
4953
quality: 90,
5054
},
51-
jpg_to_avif: {
52-
quality: 50,
55+
png_to_avif: {},
56+
57+
jpg_to_jpg: {
58+
quality: 80,
59+
mozjpeg: true,
5360
},
5461
})
5562
)
5663

57-
.pipe(gulp.dest('yourDistImagePath'))
64+
.pipe(gulp.dest("yourDistImagePath"));
5865
}
5966
```
6067

6168
## API
69+
6270
```js
6371
sharpOptimizeImages({
6472
outputImageExtname: {
@@ -67,10 +75,11 @@ sharpOptimizeImages({
6775
imageExtname_to_imageExtname: {
6876
param: value,
6977
},
70-
})
78+
});
7179
```
7280

7381
### outputImageExtname
82+
7483
Type: `object`<br>
7584
An object that allows you to convert `all` images into images of a `specific type`.
7685
<br>
@@ -85,12 +94,14 @@ avif: {
8594
```
8695

8796
#### param
97+
8898
Type: `any` (depends on the parameter)<br>
8999
Option for an output image. <br>
90100
To get acquainted with all the available parameters, please take a look:
91101
https://sharp.pixelplumbing.com/api-output#jpeg
92102

93103
### imageExtname_to_imageExtname
104+
94105
Type: `object`<br>
95106
An object that allows you to convert images of a `specific type` into images of a `specific type`. <br>
96107
Does not transmit the original. <br>
@@ -106,7 +117,8 @@ jpg_to_jpg: {
106117
},
107118
```
108119

109-
### Supported format names:
120+
### Supported format names:
121+
110122
- `png`
111123
- `jpg` | `jpeg`
112124
- `webp`
@@ -116,4 +128,5 @@ jpg_to_jpg: {
116128
- `gif`
117129

118130
### If you find a bug, please create an issue [here](https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images/issues).
131+
119132
### If this project was useful to you, you can give it a ★ in [repository](https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images).

package.json

+50-47
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,51 @@
11
{
2-
"name": "gulp-sharp-optimize-images",
3-
"version": "2.0.0",
4-
"description": "Compression and conversion of images for gulp using sharp.",
5-
"main": "index.js",
6-
"scripts": {},
7-
"type": "module",
8-
"author": {
9-
"name": "Ulyanov Ivan",
10-
"url": "https://github.com/Ulyanov-programmer"
11-
},
12-
"license": "ISC",
13-
"repository": {
14-
"type": "git",
15-
"url": "https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images"
16-
},
17-
"homepage": "https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images",
18-
"keywords": [
19-
"gulp",
20-
"sharp",
21-
"images",
22-
"image",
23-
"compress",
24-
"converter",
25-
"convert",
26-
"png",
27-
"jpg",
28-
"jpeg",
29-
"webp",
30-
"avif"
31-
],
32-
"engines": {
33-
"node": ">=14.15.0"
34-
},
35-
"bugs": {
36-
"url": "https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images/issues"
37-
},
38-
"dependencies": {
39-
"sharp": "^0.31.3",
40-
"through2": "^4.0.2",
41-
"vinyl": "^3.0.0"
42-
},
43-
"devDependencies": {
44-
"@types/sharp": "^0.31.3",
45-
"@types/through2": "^4.0.2",
46-
"@types/vinyl": "^3.0.0"
47-
}
48-
}
2+
"name": "gulp-sharp-optimize-images",
3+
"version": "2.0.0",
4+
"description": "Compression and conversion of images for gulp using sharp.",
5+
"main": "index.js",
6+
"scripts": {},
7+
"type": "module",
8+
"author": {
9+
"name": "Ulyanov Ivan",
10+
"url": "https://github.com/Ulyanov-programmer"
11+
},
12+
"license": "ISC",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images"
16+
},
17+
"homepage": "https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images",
18+
"keywords": [
19+
"gulp",
20+
"sharp",
21+
"images",
22+
"image",
23+
"compress",
24+
"converter",
25+
"convert",
26+
"png",
27+
"jpg",
28+
"jpeg",
29+
"webp",
30+
"gif",
31+
"tiff",
32+
"heif",
33+
"avif"
34+
],
35+
"engines": {
36+
"node": ">=14.15.0"
37+
},
38+
"bugs": {
39+
"url": "https://github.com/Ulyanov-programmer/gulp-sharp-optimize-images/issues"
40+
},
41+
"dependencies": {
42+
"sharp": "^0.31.3",
43+
"through2": "^4.0.2",
44+
"vinyl": "^3.0.0"
45+
},
46+
"devDependencies": {
47+
"@types/sharp": "^0.31.3",
48+
"@types/through2": "^4.0.2",
49+
"@types/vinyl": "^3.0.0"
50+
}
51+
}

0 commit comments

Comments
 (0)