-
Notifications
You must be signed in to change notification settings - Fork 21
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
gulp-cache with gulp-imagemin #16
Comments
I'll take a look, I thought #9 also referenced using imagemin. |
Just tried this with a couple different jpg's and pngs in a directory and it didn't run the imagemin task after the first run. I put my test repo up as gulpCacheTest. Can you take a look and see if there is something different between that repo and your own? Maybe the version of gulp-cache you've got installed? |
Indeed, when I upgraded now it works! Very thank you, @jgable! |
@jgable While this does work, my biggest complaint is that it eats the output from imagemin. You should see how many images were minified and what savings you got on the optimizations. I'd like to have that info personally.
To view it yourself, just remove the Any way to get this back? Should I open an issue for this? |
Does it only eat the output on subsequent runs? The first run through should give the output. It would be kind of hard to store the original output and spit it back out later when we retrieve the results from cache. |
@jgable I'm honestly unclear how to clear the cache and be sure it's cleared. Assuming one of these cleared the cache (found these calls from your source):
It always eats the output. I have to remove the Thanks for the help. |
This will clear the cache: gulp.task('clear', function (done) {
return cache.clearAll(done);
}); I've confirmed it does give the output for the imagemin task the first time you run it. You can clone down this gulpCacheTest and test yourself if you want. I don't want to store the console output from the original task, I think that could end up misleading people that the original task was originally ran when actually we are just pulling a cached file from the disk. If we start storing output it opens a lot of surface area for problems, sorry. The goal of this project isn't necessarily to be faithful to the original output of the task, it's to skip any time intensive processing done if possible. How about adding a configuration hook for when the file is loaded from cache? That could enable logging or whatever from there. You would have to do the size difference calculation yourself from the path of the cached file and the original file sent to the task. But, at least it's a start. |
Ahh, I see where we diverged. You are using a very old version of https://github.com/sindresorhus/gulp-imagemin, if you update to the latest (0.6.1), you can see no output is logged. A hook might be nice, but at the same time, if i really want to compare the file sizes of my images, I could always just write an extra gulp task to do so. Maybe that would be the better way? Thanks for the help and thoughts on this. |
Hi!
I'm using gulp-cache with other modules with success, but don't with gulp-imagemin... I'm using:
But always I ran the task all the images are treated by gulp-imagemin.
There's something it's possible to do or gulp-cache it's not supposed to do something like that?
Great plugin and best regards!
The text was updated successfully, but these errors were encountered: