Closed dandaka closed 8 years ago
Hi, any news on this? Maybe you could direct me to find the fix somewhere?
Hi @dandaka could you please reproduce the error with gulp-responsive@2.0.0
. It should log the filename.
I think I get idea, why it doesn't work. I got this code working:
// Test subfolders
gulp.task('responsive-subfolders', function () {
gulp.src(['./src/content/portfolio/**/*.png'])
.pipe(print())
.pipe(responsive({
'**/*.png': [
{
width: 2000,
rename: rename2000,
quality: 80
}]},
{
errorOnUnusedImage: false,
errorOnEnlargement: false
}))
.pipe(gulp.dest('./tmp/'));
});
The difference is in this line:
'**/*.png': [
— no error
'*.png': [
— Error: Available images do not match following config:
Is it a bug? Since in your example you don't specify folders (only filenames), expected behaviour here is the same — no **/
, only file *.png
.
Hi @dandaka
It is exactly how minimatch
works.
minimatch is used by gulp
itself. So I decided to use the same matching library for my plugin.
match any file and any subfolder
gulp.src(['./src/content/portfolio/**/*.png'])
.pipe(responsive({
'**/*.png': [{...}]
}))
match any file
gulp.src(['./src/content/portfolio/*.png'])
.pipe(responsive({
'*.png': [{...}]
}))
match any file
gulp.src(['./src/content/portfolio/*.png'])
.pipe(responsive({
'**/*.png': [{...}]
}))
not match
gulp.src(['./src/content/portfolio/**/*.png'])
.pipe(responsive({
'*.png': [{...}]
}))
Thank you for clarification. Still think it is strange behaviour.
Expected behaviour:
Code:
Log: