-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console shows "Images Optimized", but there are no images in output folder. #23
Comments
yes thats true, me too. |
Yes, the problem does not seem to be with the plugin itself, however. It looks like a possible upstream issue: imagemin/imagemin#327 |
In my case it seems that the plugin was unable to support the file type. I'm not sure why no errors were thrown, but I've solved it using different methods and determining the mime type ahead of time.... Ultimately the plugin is using this library: https://www.npmjs.com/package/cwebp-bin So it seems if the image conversion fails in that library then the output from imagemin is the original file. |
Also example of usage on imagemin-webp is little bit misleading, dunno if imagemin has a new API but below should work: const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');
(async () => {
const files = await imagemin(['./images/*.{jpg}'], {
destination: 'build/images',
plugins: [imageminWebp()],
});
console.log(files);
})(); |
Had the same problem and @cksho example code solved it. |
Hello, I already used the
|
For those who are having this problem, the const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');
(async () => {
const img = await imagemin(['images/*.jpg'], {
destination: 'build/images',
plugins: [
imageminWebp({quality: 100})
]
});
console.log('Images optimized');
console.log(img)
})(); |
For Windows users. const path = require('path');
const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');
(async () => {
const img = await imagemin([path.resolve(__dirname, 'img/*.{jpg,png}').replace(/\\/g, '/')], {
destination: path.resolve(__dirname, 'dist/webp').replace(/\\/g, '/'),
plugins: [imageminWebp({ quality: 70 })],
});
console.log('Images optimized');
console.log(img);
})(); |
it can’t done, and the problem still as usuall @LambdaZed |
Hi! Did someone find a solution? It is still a problem... |
Hi,
in "images/" I have several .jpg images. I use the code from example and run it in node.js environment. After running the script I'm getting 'Images optimized' in console log, but nothing happens. The whole process takes less than 1 sec. Are those images converted, but not saved? Or they're just skipped?
The text was updated successfully, but these errors were encountered: