Getting jekyll-assets and jekyll-webp to play nicely together #34
-
My client is really passionate about their Google Lighthouse scores, so I converted all the JPGs on the site to webp format. I need to make sure any new JPGs they upload are also converted. I found a # _config.yml
webp:
enabled: true
quality: 100
img_dir:
- _uploads The problem I'm having is getting the assets:
sources:
- _uploads
destination: "/assets" As you can see, I can configure both a <img src="{% asset '{{ page_photo }}' @path %}"> With this configuration, I get an error when generating the Siteleaf preview after any new JPG is uploaded:
I also get this error locally. I noticed the I was able to get it working locally by adding assets:
sources:
- _uploads
- _site/_uploads
destination: "/assets" I thought this would be a great solution! Both But when attempting to generate a Siteleaf preview, I get the same error:
(The site is https://github.com/CunningFolkDev/elevate360_website/tree/master if that helps) Thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @jeremylenz 👋 You might need to ask the creator of the gem(s) to see if they are compatible, but I'll see if I can help here! Here's a couple suggestions:
Hope that helps! |
Beta Was this translation helpful? Give feedback.
Hi @jeremylenz 👋
You might need to ask the creator of the gem(s) to see if they are compatible, but I'll see if I can help here!
Here's a couple suggestions:
The
_site
folder is Jekyll's default output folder, but can't guarantee this name in a cloud environment. Can you try using a different folder name that is not the output folder? (this is typically not meant to be used for input)To avoid conflicts with these 2 gems, could you just use
jekyll-assets
to generate the webp? https://github.com/envygeeks/jekyll-assets/blob/056d2c88719ef3b1f90967a606dd1441581dd832/README.md#vipsformatLastly, you could offload image processing to a CDN like imgix (free if you have <1000 images) or Cl…