sverrirs / jekyll-webp

WebP image generator gem for Jekyll websites
https://rubygems.org/gems/jekyll-webp
MIT License
65 stars 22 forks source link

nested: false Bug #13

Open inetbiz opened 3 years ago

inetbiz commented 3 years ago

If if nested: false set to true, it still does not travel directories nested within the image folder.

webp:
  enabled: true

  # The quality of the webp conversion 0 to 100 (where 100 is least lossy)
  quality: 75

  # List of directories containing images to optimize, nested directories will only be checked if `nested` is true
  # By default the generator will search for a folder called `/img` under the site root and process all jpg, png and tiff image files found there.
  img_dir: ["/assets/images"]

  # Whether to search in nested directories or not
  nested: true

  # add ".gif" to the format list to generate webp for animated gifs as well
  formats: [".jpeg", ".jpg", ".png", ".tiff"]

  # File extensions for animated gif files 
  gifs: [".gif"]

  # Set to true to always regenerate existing webp files
  regenerate: true

  # Local path to the WebP utilities to use (relative or absolute)
  # Omit or leave as nil to use the utilities shipped with the gem, override only to use your local install
  webp_path: nil

  # List of files or directories to exclude
  # e.g. custom or hand generated webp conversion files
  exclude: []

  # append '.webp' to filename after original extension rather than replacing it.
  # Default transforms `image.png` to `image.webp`, while changing to true transforms `image.png` to `image.png.webp`
  append_ext: true
############################################################
ghowen commented 3 years ago

I can confirm this. I just installed the plugin and experience the same bug.

ghowen commented 3 years ago

@inetbiz Try adding a slash to your image path. This solved it for me. It should be mentioned in the docs though...

minamfg commented 3 years ago

this happened to me too but after adding slash it worked

BerkhanEminsoy commented 2 years ago

@inetbiz Try adding a slash to your image path. This solved it for me. It should be mentioned in the docs though...

where are you adding this slash? img_dir? or to the actual directory path? Mine throws an error after appending a slash to the path.

ghowen commented 2 years ago

where are you adding this slash? img_dir? or to the actual directory path? Mine throws an error after appending a slash to the path.

img_dir

BerkhanEminsoy commented 2 years ago

I get 0 file(s) generated with img_dir w/o an appended slash and a build error w/ an appended slash. See repo. When I append a slash I get an invalid argument @ ..assets/img/C: somehow

ghowen commented 2 years ago

@BerkhanEminsoy Maybe the beginning of your img_dir is wrong. Here is the line in my _config.yml that works fine: img_dir: ["/assets/img/"]

BerkhanEminsoy commented 2 years ago

@BerkhanEminsoy Maybe the beginning of your img_dir is wrong. Here is the line in my _config.yml that works fine: img_dir: ["/assets/img/"]

mine is exactly the same; img_dir: ["/assets/img/"] --> this throws an error. Though my images are actually located two directories under like so; assets/img/projects/project/. And funny enough, dir projects doesn't show up in vs code autocomplete. Maybe it's because I have another folder with . in it under img dir? (like so; img/folder.ico/favicon) Though highly doubt that...