-
Notifications
You must be signed in to change notification settings - Fork 29
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
Using with plugin that renames final files? #17
Comments
Hi Bryce! 👋 Thanks for providing the repo branch - it makes the discussion so much easier. There's two issues I'm aware of that might be impacting your project:
Issue 1 I haven't tried eleventy-plugin-local-respimg yet, but I've had success combining this plugin with eleventy-plugin-local-images which also moves and renames files. You can find a working example here. The key to solving this problem was the order in which the plugins are defined in Issue 2 This plugin assumes your file paths match the output paths, i.e. This can be resolved using the Something like this might work for you (untested): // .eleventy.js
eleventyConfig.addPlugin(lazyImagesPlugin, {
transformImgPath: (imgPath) => {
if (imgPath.startsWith('/') && !imgPath.startsWith('//')) {
return `./src${imgPath}`;
}
return imgPath;
},
}); TLDR; Try reordering the plugins in Also try changing the lazyimages I might have some time later this week, I'll pull down your repo and take a look if the above doesn't solve it 😃 |
@liamfiddler Your solution indeed solves it. Thanks very much! |
...excellent help from Liam (liamfiddler/eleventy-plugin-lazyimages#17 (comment))!
I have, however, found that using that other plugin with yours prevents your plugin's use of the base64 files for LQIP purposes (which reduces yours to only lazy-loading). Unfortunately, if I go without that other plugin, then I'm not delivering responsive images, I know I'm an edge case so it's probably not a biggie, but just FYI. |
I was worried that might be the case. JIMP (the library used by this plugin to read image data) doesn't support WEBP. I've been investigating switching to another library, Sharp, which should handle this use case. Watch this space! |
Yes, I briefly used a spaghetti-ish script of my own with Sharp, while trying to get your plugin and that other one to work, and was astounded by its performance. Looking forward to that switch! |
I did try it with Safari, too, just to see if it was a Chrome/Chromium thing, and got the same results — no base64 stuff. |
The newly released v2 of this plugin supports WEBP 🎉 In addition, the plugin will now automatically check for a |
I have a repo branch at https://github.com/brycewray/eleventy_solo/tree/base where, among other things, I'm attempting to use both this plugin and eleventy-plugin-local-respimg. Whenever I try to do a dev build, your plugin initially seems to work but, then, the console output becomes a long string of
Error: ENOENT
-type messages indicating the image files and/or their directories don't exist. This doesn't happen if I'm not using your plugin. Since the other plugin (like others that generate responsive images) renames the final files in the Eleventy output directory, is that related to this issue I'm experiencing? Note that I'm getting these error messages even on files I specifically exclude from that other plugin, specifically the files in/src/images/icons/
.Thanks in advance for any help and/or info you can provide; please let me know if you need additional details about the issue I'm experiencing.
The text was updated successfully, but these errors were encountered: