check contents length for empty file

This commit is contained in:
AJ Ostrow 2015-06-10 17:45:12 -04:00
parent 1f54efec9d
commit 7f6605e433
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