jeudi 16 avril 2015

gulp plugin looping through all files and folders

OK so I am creating a gulp plugin to create a table of contents and imports for my sass setup.


I have the gulp task all setup like this



var sgc = require('./tasks/sass-generate-contents');
gulp.task('sass-generate-contents', function(){
gulp.src(config.tests + '/**/*.scss')
.pipe(sgc(config.tests + '/_main.scss'));
});


and then my plugin code



function sassGenerateContents(){

return through.obj(function(file, enc, cb){
if (file.isNull()) {
cb(null, file);
return;
}

if (file.isStream()) {
cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
return;
}

console.log(file);

});

}

module.exports = sassGenerateContents;


in my file system (the test directory) are 3 x *.scss files


the console log in the plugin only ever returns the first. I'm probably missing somehting really obvious here, but I thought the idea of **/* was to loop through the folder structure specified and pull out the files.


Can someone explain to me why it's only returning the first file?


Thanks


Aucun commentaire:

Enregistrer un commentaire