Answer the question
In order to leave comments, you need to log in
How to split a stream into multiple files in Gulp.js?
Hello everyone, I have one task in gulpfile.js:
var global_css = [
'./source/sass/global/*.scss',
'./source/sass/features/*.scss',
'./source/sass/pages/*.scss',
'./source/sass/layout/*.scss'
];
gulp.task('sass-global', function () {
return gulp.src(global_css)
.pipe(plugins.plumber({errorHandler: plugins.notify.onError("<%= error.message %>")}))
.pipe(plugins.sourcemaps.init())
.pipe(plugins.sass())
.pipe(plugins.autoprefixer({
browsers: prefix_list,
cascade: false
}))
.pipe(plugins.csscomb('./dev/libs/comb/research.json'))
.pipe(plugins.sourcemaps.write('./'))
.pipe(gulp.dest('./public/css'));
});
Answer the question
In order to leave comments, you need to log in
var merge = require('merge-stream');
gulp.task('sass-global', function () {
var merged = merge();
global_css.forEach((entry) => {
merged.add(gulp.src(entry)
.pipe(plugins.plumber({errorHandler: plugins.notify.onError("<%= error.message %>")}))
.pipe(plugins.sourcemaps.init())
.pipe(plugins.sass())
.pipe(plugins.autoprefixer({
browsers: prefix_list,
cascade: false
}))
.pipe(plugins.csscomb('./dev/libs/comb/research.json'))
.pipe(plugins.sourcemaps.write('./'))
.pipe(gulp.dest('./public/css')));
});
return merged;
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question