question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with subfolders

See original GitHub issue

Expected behaviour:

  1. gulp-responsive takes files from subfolders
  2. transforms them
  3. puts in subfolders in the output folder

Code:

gulp.task('responsive2', function () {
  gulp.src('./src/img/**/*.jpg')
    .pipe(print())
    .pipe(responsive([{
      name: 'banner.jpg',
      width: 600
      }],
      {
        errorOnUnusedImage: false
      }
    ))
    .pipe(gulp.dest('./public/img/'));
});

Log:

[frontend-boilerplate] gulp responsive2                               master  ✭
[15:31:46] Using gulpfile ~/projects/frontend-boilerplate/gulpfile.js
[15:31:46] Starting 'responsive2'...
[15:31:46] Finished 'responsive2' after 9.45 ms
[15:31:46] src/img/imgs/banner.jpg

stream.js:75
      throw er; // Unhandled stream error in pipe.
      ^
Error: Available images do not match following config:
  - `banner.jpg`

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
mahnunchikcommented, Feb 15, 2016

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': [{...}]
    }))
2reactions
dandakacommented, Feb 6, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subfolders and content not displaying - Microsoft Community
In my teams shared mail box, when I select a folder, none the contents are displayed which were previously inserted.
Read more >
Git not pushing all subfolders or subdirectories - Stack Overflow
I solved it by removing all the git folders using rm -rf .git and then reinitializing and recommitting my work. Hope this helps....
Read more >
unable to search within subfolders in Box? (Windows 10)
If I'm already in the subfolder I want, then it will search its contents, but this is unhelpful if looking for a file...
Read more >
Does not work when WP installed in subfolder / subdirectory
htaccess inside that subdirectory and not in the main folder. It does work on initial install, but when cache is cleared or WordPress...
Read more >
No more possibility to select subfolders for sync with last ...
Hi team, I have upgraded Owncloud with the last release this morning on my Windows desktop. It appears that I can no more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found