eleventy-plugin-local-images
eleventy-plugin-local-images copied to clipboard
Use existing images if found
- Set distPath to images or _src/images (wherever you want to permanently store the images)
- Add option
useExisting: true
when adding the plugin
The plugin will use an existing file (if found), otherwise it will attempt a download from the source. This way you have a permanent cache of the images, instead of re-downloading on every build.
This plugin functions in exactly the same way as before if the useExisting
option is not found.
Hey @datashaman really appreciate the contribution. Would it be possible to reduce down the changes to just what's described? The configuration files can be done in another pull request 😊
fixed, haven't got an installation to see if it works 100% anymore tho. ymmv. :)
Thanks for updating @datashaman, much more concise. There is actually a demo in the repo now which can be used for development.
Probably best you check that out if you can, as it shows a regression from these changes. The demo uses a placeholder service which obscures the filename extension and causes the plugin to error.
Ideally duplicate images should be found without the need for the filename extension. Additionally, if the step was to fail then the images should be downloaded without attempting to locate duplicates, thus maintaining original behaviour.
Hope this makes sense 😊