jekyll-webp icon indicating copy to clipboard operation
jekyll-webp copied to clipboard

Add slash to search pattern if missing

Open Birne94 opened this issue 6 years ago • 4 comments
trafficstars

When specifying an image directory without a trailing slash, the search pattern won't pick up images in subdirectories because a wrong pattern is generated (e.g. /images**/*.* vs /images/**/*.*).

If a slash is missing, it is now appended before building the search pattern.

This should also fix #6

Birne94 avatar Oct 24 '19 14:10 Birne94

Hi Daniel @Birne94 thank you for taking the time to submit the two PRs. The help is much appreciated :) There is a slight conflict with this change which I was wondering if you'd be willing to resolve so that I can merge?

sverrirs avatar Oct 28 '19 21:10 sverrirs

I have resolved the conflict, but I think this introduces some inconsistent behavior now. When the new nested option is set to false and the image directory ends with a slash, nested images are still included. When this PR is merged, the nested flag will become irrelevant since nested images are always getting included.

You should decide if nested searching should be always enabled (then a slash should be appended as in this PR) or configurable by the user (then the glob pattern should change from /**/*.* to /*.* if disabled).

Birne94 avatar Oct 29 '19 08:10 Birne94

Good point, I will investigate this further

sverrirs avatar Oct 29 '19 20:10 sverrirs

any leads on this one? 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

BerkhanEminsoy avatar Dec 01 '21 11:12 BerkhanEminsoy