Last active
August 29, 2015 14:20
-
-
Save elado/d847c4dd0e8e5f03d82b to your computer and use it in GitHub Desktop.
gulp-sass-parallel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sass(path) { | |
var cssFilter = $.filter('**/*.css'); | |
return gulp.src(path, { base: 'app', dot: true }) | |
.pipe($.changed($.config.tmp, {extension: '.css'})) | |
.pipe($.plumber()) | |
.pipe($.rubySass({ | |
container: path.replace(/[\*\/]/g, "_") | |
})) | |
.on('error', $.util.log) | |
.on('error', $.util.beep) | |
.pipe($.autoprefixer('last 1 version')) | |
.pipe(gulp.dest($.config.tmp)) | |
.pipe(cssFilter) | |
.pipe($.browserSync.reload({stream:true})) | |
.pipe(cssFilter.restore()) | |
.pipe($.size()); | |
} | |
var sassPaths = [ | |
'app/components/controls', | |
'app/components/screens', | |
'app/styles', | |
]; | |
sassPaths.forEach(function (path, i) { | |
gulp.task('sass' + i, function () { | |
return sass(path + '/**/*.scss'); | |
}); | |
}); | |
gulp.task('sass', function (done) { | |
var tasks = sassPaths.map(function (path, i) { return 'sass' + i; }); | |
return $.runSequence(tasks, done); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment