Generated Images automatically deleted/disappeared (Fix Included)
LordAmit opened this issue · 2 comments
First of all, thank you for making Jekyll Picture Tag. Can not do without it!
I already solved the issue on my own, but putting it here in case someone else in future is confused about it like me.
Observed behavior
Images are generated according to log. But the images are not there in the build directory (default is _site
).
Diagnosis/Fix Attempts (and failed)
- Observing the directory tree when building. Shows the directory that's supposed to contain images for a second, then the directory disappears.
- removing unused plugins thinking they might be causing conflicts.
- setting
export JEKYLL_LOG_LEVEL=debug
before building, just shows that images were generated.
What really Happens
keep_files
. Jekyll has this thing called clobbering. Anything that's not generated by jekyll directly is removed. For some reason it started happening to me only recently. Maybe because I updated my jekyll
gem, and the latest update broke things.. But anyway, images generated by jekyll_picture_tag
falls under the "gotta-clobber-by-default" category by Jekyll. Hence, you need to add the following entry in your _config.yml
file.
Solution
keep_files: [
"<generated images directory path with respect to the destination>"]
That should fix it.
Thanks again!
Thanks for the bug report! We were already doing this, but I guess Jekyll changed the configuration format. Hopefully it's an easy fix, though supporting multiple versions of Jekyll may require some added complexity.
Got it!
My two cents: Since this is something being handled from Jekyll's end, telling the user to check the up-to-date instructions from Jekyll instead of handling it programmatically from this endpoint will be easier to maintain and future-safe. Otherwise, there is always this chance that Jekyll will change how things work, thus breaking this plugin.