Skip to content

Commit 1514570

Browse files
author
Gleb Mikheev
committed
readme
1 parent ce46ebf commit 1514570

File tree

1 file changed

+17
-126
lines changed

1 file changed

+17
-126
lines changed

README.md

Lines changed: 17 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# image-optimize-loader
22

3-
Optimize images with global caching and png to jpg conversion (on the go)
3+
Optimize images with global caching and non-transparent png to jpg conversion (on the go)
44
> Rework of https://github.com/tcoopman/image-webpack-loader
55
66
## Install
@@ -25,141 +25,32 @@ loaders: [
2525
## Configuration
2626

2727
```
28-
{
28+
{ // default configuration example
2929
imageOptimizeLoader: {
30-
pngquant:{
31-
quality: "65-90",
30+
optimizer: {
31+
covertPngToJpg:true
32+
},
33+
pngquant: {
34+
quality: '65-80',
3235
speed: 4
3336
},
34-
svgo:{
35-
plugins: [
36-
{
37-
removeViewBox: false
38-
},
39-
{
40-
removeEmptyAttrs: false
41-
}
37+
mozjpeg:{
38+
targa: false,
39+
},
40+
svgo: {
41+
plugins:[
42+
{ removeComments: true },
43+
{ sortAttrs: true },
44+
{ minifyStyles: true },
4245
]
4346
}
44-
}
4547
}
4648
```
4749

4850
Comes bundled with the following optimizers:
49-
- [gifsicle](https://github.com/kevva/imagemin-gifsicle)*Compress GIF image*
50-
- [jpegtran](https://github.com/kevva/imagemin-jpegtran)*Compress JPEG images*
51-
- [optipng](https://github.com/kevva/imagemin-optipng)*Compress PNG images*
51+
- [mozjpeg](https://github.com/imagemin/imagemin-mozjpeg)*Compress JPEG images*
5252
- [svgo](https://github.com/kevva/imagemin-svgo)*Compress SVG images*
53-
- [pngquant](https://pngquant.org/)*Compress PNG images*
54-
55-
### imagemin(options)
56-
57-
Unsupported files are ignored.
58-
59-
### options
60-
61-
Options are applied to the correct files.
62-
63-
#### optimizationLevel *(png)*
64-
65-
Type: `number`
66-
Default: `3`
67-
68-
Select an optimization level between `0` and `7`.
69-
70-
> The optimization level 0 enables a set of optimization operations that require minimal effort. There will be no changes to image attributes like bit depth or color type, and no recompression of existing IDAT datastreams. The optimization level 1 enables a single IDAT compression trial. The trial chosen is what. OptiPNG thinks it’s probably the most effective. The optimization levels 2 and higher enable multiple IDAT compression trials; the higher the level, the more trials.
71-
72-
Level and trials:
73-
74-
1. 1 trial
75-
2. 8 trials
76-
3. 16 trials
77-
4. 24 trials
78-
5. 48 trials
79-
6. 120 trials
80-
7. 240 trials
81-
82-
#### progressive *(jpg)*
83-
84-
Type: `boolean`
85-
Default: `false`
86-
87-
Lossless conversion to progressive.
88-
89-
#### interlaced *(gif)*
90-
91-
Type: `boolean`
92-
Default: `false`
93-
94-
Interlace gif for progressive rendering.
95-
96-
#### svgo *(svg)*
97-
98-
Type: `object`
99-
Default: `{}`
100-
101-
Pass options to [svgo](https://github.com/svg/svgo).
102-
103-
#### bypassOnDebug *(all)*
104-
105-
Type: `boolean`
106-
Default: `false`
107-
108-
Using this, no processing is done when webpack 'debug' mode is used and the loader acts as a regular file-loader. Use this to speed up initial and, to a lesser extent, subsequent compilations while developing or using webpack-dev-server. Normal builds are processed normally, outputting oprimized files.
109-
110-
### imageminPngquant(options)
111-
112-
#### options.floyd
113-
114-
Type: `number`
115-
Default: `0.5`
116-
117-
Controls level of dithering (0 = none, 1 = full).
118-
119-
#### options.nofs
120-
121-
Type: `boolean`
122-
Default: `false`
123-
124-
Disable Floyd-Steinberg dithering.
125-
126-
#### options.posterize
127-
128-
Type: `number`
129-
130-
Reduce precision of the palette by number of bits. Use when the image will be
131-
displayed on low-depth screens (e.g. 16-bit displays or compressed textures).
132-
133-
#### options.quality
134-
135-
Type: `string`
136-
137-
Instructs pngquant to use the least amount of colors required to meet or exceed
138-
the max quality. If conversion results in quality below the min quality the
139-
image won't be saved.
140-
141-
Min and max are numbers in range 0 (worst) to 100 (perfect), similar to JPEG.
142-
143-
#### options.speed
144-
145-
Type: `number`
146-
Default: `3`
147-
148-
Speed/quality trade-off from `1` (brute-force) to `10` (fastest). Speed `10` has
149-
5% lower quality, but is 8 times faster than the default.
150-
151-
#### options.verbose
152-
153-
Type: `boolean`
154-
Default: `false`
155-
156-
Print verbose status messages.
157-
158-
## Inspiration
159-
160-
* [gulp-imagemin](https://github.com/sindresorhus/gulp-imagemin)
161-
* [file-loader](https://github.com/webpack/file-loader)
162-
* [imagemin-pngquant](https://github.com/imagemin/imagemin-pngquant)
53+
- [pngquant](https://github.com/imagemin/imagemin-pngquant)*Compress PNG images*
16354

16455
## License
16556

0 commit comments

Comments
 (0)