Add caching
ehmicky opened this issue · 0 comments
ehmicky commented
Image processing can be quite slow.
It would be great if the minified images could be cached, so minification does not happen on the next build if the image has not changed.
For example:
{publishDir}/image.png
is found- It is minified to
{publishDir}/image-{hash}.png
, wherehash
is the file's content hash cache.save('{publishDir}/image-{hash}.png')
is called (seecache
utility documentation here)- on the next run,
cache.restore('{publishDir}/image-{hash}.png')
is called. If it returnstrue
, that file does not need to be minified again {publishDir}/image-{hash}.png
is finally moved to{publishDir}/image.png
What do you think?