Thursday, 11 May 2017

Get the number of files within a directory within Gulp.js?

So far I have tried using the glob-fs package like so:

  let cssFileCount;
  glob.readdir('public/css/*.css', function (err, files) {
    if (err) return console.error(err);
    console.log(files);
    cssFileCount = (files.length);
  });

This works perfectly fine with the path to my JS files public/js/*.js however when I use my public/css/*.css it doesn't work.

Is there any other way I can check the number of files within a directory using Globbing?



via Nick Maddren

No comments:

Post a Comment