Merge pull request #294 from aj0strow/fix-empty-file

check contents length for empty file
This commit is contained in:
Vincent Prouillet 2015-06-19 04:54:21 +01:00
commit e8ed3bdc63
4 changed files with 10 additions and 0 deletions

View file

@ -25,6 +25,9 @@ var gulpSass = function gulpSass(options, sync) {
if (file.isStream()) {
return cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
}
if (!file.contents.length) {
return cb(null, file);
}
if (path.basename(file.path).indexOf('_') === 0) {
return cb();
}

0
test/expected/empty.css Normal file
View file

View file

@ -414,4 +414,11 @@ describe('gulp-sass -- sync compile', function() {
}))
.on('end', done);
});
it('should work with empty files', function(done) {
gulp.src(path.join(__dirname, '/scss/empty.scss'))
.pipe(sass.sync())
.pipe(gulp.dest(path.join(__dirname, '/results/')))
.on('end', done);
});
});

0
test/scss/empty.scss Normal file
View file