grunt-imagine
grunt-imagine copied to clipboard
jpgmin with quality does not overwrite files if dest matches src
If the src matches the dest:
jpgmin : {
quality : 30,
src : ['tmp/**/*.jpg'],
dest : 'tmp',
}
Then the quality doesn't seem to make a difference:
Running "jpgmin" task
>> Compressed 1 files
>> Uncompressed size: 2577.7kb, Compressed size: 2461.01kb, Savings: 4.53%
However if I change the dest directory:
jpgmin : {
quality : 30,
src : ['tmp/**/*.jpg'],
dest : 'other',
}
Then here is the output:
Running "jpgmin" task
>> Compressed 1 files
>> Uncompressed size: 2577.7kb, Compressed size: 85.65kb, Savings: 96.68%
This compresses, however the file is written to: other/img/filename.jpg ... I would like to be able to overwrite the file as this is a step in a chain of modifications to the image...
The output is a bit misleading, I originally designed the task to not overwrite source files (to avoid accidentally losing image information like EXIF data).
If you really wan't to override your source files, run imagine first & "manually" apply a step that will move/copy the files afterwards.
@alpadev @LaurentGoderre: Should we add a warning/info message if imagine tries to override the source files giving the user a hint?!
Maybe there should be a flag to allow overwriting but by default it could give a warning when overwriting a file?
I like the overwrite: true flag idea