Gulpjs combine two tasks into a single task

后端 未结 11 1161
攒了一身酷
攒了一身酷 2020-12-24 01:56

I currently have two tasks, that both compile sass files. I would still like to concat the two directories into separate files but it seems that it would be more maintainabl

11条回答
  •  盖世英雄少女心
    2020-12-24 02:31

    Have you tried using merge-stream?

    merge = require('merge-stream');
    // Compile Our Sass
    gulp.task('sass', function() {
      var bootstrap = gulp
          .src('./public/bower/bootstrap-sass/lib/*.scss')
          .pipe(sass())
          .pipe(concat('bootstrap.css'))
          .pipe(gulp.dest('./public/dist/css'));
    
      var site = gulp
          .src('./public/src/scss/*.scss')
          .pipe(sass())
          .pipe(concat('site.css'))
          .pipe(gulp.dest('./public/dist/css'));
    
      return merge(bootstrap, site);
    
    });
    

    See https://blog.mariusschulz.com/2015/05/02/merging-two-gulp-streams for more details

提交回复
热议问题