imagemin-webp-webpack-plugin
Advanced tools
Comparing version 3.3.4 to 3.3.5
# Changelog | ||
* V3.3.5 | 19/07.2021 | ||
- added support for **GIF** images via [imagemin-gif2webp](https://www.npmjs.com/package/imagemin-gif2webp) (https://github.com/iampava/imagemin-webp-webpack-plugin/issues/35) | ||
* V3.3.4 | 5/04/2021 | ||
- updated dependencies | ||
* V3.3.2 | 6/05/2020 | ||
- updated packages due to security vulnerabilities |
{ | ||
"name": "imagemin-webp-webpack-plugin", | ||
"version": "3.3.4", | ||
"version": "3.3.5", | ||
"description": "Webpack plugin which converts images to the WebP format while also keeping the original files.", | ||
@@ -24,4 +24,5 @@ "author": { | ||
"imagemin": "^7.0.1", | ||
"imagemin-gif2webp": "^3.0.0", | ||
"imagemin-webp": "^6.0.0" | ||
} | ||
} |
const imagemin = require('imagemin'); | ||
const webp = require('imagemin-webp'); | ||
const gif2webp = require('imagemin-gif2webp'); | ||
@@ -55,3 +56,6 @@ const GREEN = '\x1b[32m%s\x1b[0m'; | ||
.buffer(currentAsset.source(), { | ||
plugins: [webp(this.config[i].options)] | ||
plugins: [ | ||
webp(this.config[i].options), | ||
gif2webp(this.config[i].quality), | ||
] | ||
}) | ||
@@ -58,0 +62,0 @@ .then(buffer => { |
@@ -7,3 +7,3 @@ # imagemin-webp-webpack-plugin | ||
It uses [imagemin](https://www.npmjs.com/package/imagemin) and [imagemin-webp](https://www.npmjs.com/package/imagemin-webp) under the hood. | ||
It uses [imagemin](https://www.npmjs.com/package/imagemin), [imagemin-webp](https://www.npmjs.com/package/imagemin-webp) and [imagemin-gif2webp](https://www.npmjs.com/package/imagemin-gif2webp) under the hood. | ||
@@ -13,3 +13,3 @@ | ||
Although WebP images are not currently supported in all browsers, they are at least 25% smaller than PNG's or JPEG's. So, certain users can get a much better experience. | ||
Although WebP images are not currently supported in all browsers, they are at least 25% smaller than PNG's or JPEG's. So, certain users can get a much better experience. WebP also supports Gif-like functionality so this plugin also works for GIF images. | ||
@@ -85,3 +85,3 @@ Check the support tables on [Can I use](https://caniuse.com/#feat=webp) | ||
* **test** - a RegExp selecting just certain images | ||
* **test** - a RegExp selecting just certain images. Supported image formats are **JPG**, **PNG** and **GIF**. | ||
* **options** -the converting options for the images that pass the above RegExp | ||
@@ -88,0 +88,0 @@ |
@@ -15,2 +15,3 @@ { | ||
"html-webpack-plugin": "^3.2.0", | ||
"imagemin-webp-webpack-plugin": "^3.3.4", | ||
"mini-css-extract-plugin": "^0.8.2", | ||
@@ -23,4 +24,3 @@ "optimize-css-assets-webpack-plugin": "^5.0.4", | ||
"webpack-merge": "^4.2.2" | ||
}, | ||
"dependencies": {} | ||
} | ||
} |
@@ -0,8 +1,22 @@ | ||
const fs = require('fs'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
const webpackMerge = require('webpack-merge'); | ||
const ImageminWebpWebpackPlugin = require('../plugin'); | ||
const modeConfig = env => require(`./build-utils/webpack.${env}`)(env); | ||
/** | ||
* If we don't copy the plugin in this project when | ||
* using it like this, we get a very strange error regarding | ||
* | ||
* > \cwebp-bin\\vendor\\cwebp.exe | ||
* | ||
* It seems it's trying to use it from the root `node_modules` | ||
* but there's no `vendor` subfolder there and it fails. | ||
* | ||
* TODO: find a proper/better solution than this 👇 | ||
*/ | ||
fs.copyFileSync('../plugin.js', 'plugin.js'); | ||
const ImageminWebpWebpackPlugin = require('./plugin'); | ||
module.exports = ({ mode }) => | ||
@@ -48,3 +62,9 @@ webpackMerge( | ||
detailedLogs: true, | ||
overrideExtension: true | ||
overrideExtension: true, | ||
config: [{ | ||
test: /\.(jpe?g|png|gif)/, | ||
options: { | ||
quality: 75 | ||
} | ||
}], | ||
}) | ||
@@ -51,0 +71,0 @@ ] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1895967
18
23667
3
3
+ Addedimagemin-gif2webp@^3.0.0
+ Addedgif2webp-bin@3.0.3(transitive)
+ Addedimagemin-gif2webp@3.0.0(transitive)
+ Addedis-gif@3.0.0(transitive)
+ Addedpify@4.0.1(transitive)