0
votes

The gulp.src function returns 32 files but only 1 file is returned from sass().

I'm new to gulp and was hoping someone could point out why all 32 files aren't being piped into the sass() function or why only 1 file is being processed and return by sass().

gulp.src(folderFound.path + "/*.scss") //32 files found output log shown below

.pipe( sass() ) //Only 1 file returned from sass() to save as .css

/* File: gulpfile.js */

// grab our gulp packages
var gulp  = require('gulp');
var gutil = require('gulp-util');
var path = require('path');
var concat = require('gulp-concat');
var recursiveFolder = require('gulp-recursive-folder');

var options = {
    pathToFolder: './sass/',
    readFolder: './sass/',
    target: './Compiled'
}

var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('generateTree', recursiveFolder({
    base: options.pathToFolder,
    exclude: [    // exclude the debug modules from thus build 
        'debug-modules'
    ] 
}, function(folderFound){

return gulp.src(folderFound.path + "/*.scss")     
    .on("data", function(test) { 
   gutil.log("Found Files: ", test.path);
})
   .pipe(

     sass().on('error',

     function(test) { 
   gutil.log("error: ", test.path);
})
     )
.on("data", function(test) { 
   gutil.log("SASS Processed: ", test.path);
})

   .pipe(gulp.dest('./css'));   
     ;
}));


[16:18:40] Using gulpfile d:\Materialize\materialize-src\gulpfile.js
[16:18:40] Starting 'generateTree'...
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\materialize.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_buttons.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\date_picker\_default.date.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_checkboxes.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_cards.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\date_picker\_default.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_file-input.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_carousel.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\date_picker\_default.time.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_forms.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_chips.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_input-fields.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_collapsible.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_radio-buttons.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_color.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_range.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_dropdown.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_select.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_global.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\forms\_switches.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_grid.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_icons-material-design.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_materialbox.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_mixins.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_modal.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_navbar.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_normalize.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_prefixer.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_preloader.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_roboto.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_sideNav.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_slider.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_table_of_contents.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_tabs.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_toast.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_tooltip.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_typography.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_variables.scss
[16:18:40] Found Files:  d:\Materialize\materialize-src\sass\components\_waves.scss
**[16:18:40] SASS Processed:  d:\Materialize\materialize-src\sass\materialize.css**
[16:18:40] Finished 'generateTree' after 162 ms
1

1 Answers

2
votes

All of your .scss files are what are calledĀ "partials" except materialize.css.

"Partials

You can create partial Sass files that contain little snippets of CSS that you can include in other Sass files. This is a great way to modularize your CSS and help keep things easier to maintain. A partial is simply a Sass file named with a leading underscore. You might name it something like _partial.scss. The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file. Sass partials are used with the @import directive."

from sass language guide

So you are getting expected behavior - partials, starting with an underscore, do not produce an output file but areĀ used to be included within another file.