Gulp for multi scripts

0 votes
195 views
added Jun 29, 2018 in Gulp by LC Marshal Captain (25,790 points)
edited Jul 12, 2019 by LC Marshal

//any scripts in the scripts/ folder will be unified as script.js
gulp.task('script', function() {
  return gulp
    .src(
      environment ?
      config.js.exclude.concat(config.basedir + config.themedir + config.js.src) :
      config.basedir + config.themedir + config.js.src
    )
    .pipe(sourcemaps.init())
    .pipe(concat('script.js'))
    .pipe(wrap('(function($){\n<%= contents %>\n})(jQuery);'))
    .pipe(header(banner, { pkg: pkg }))
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(config.basedir + config.themedir + config.js.dest));
});

gulp.task('babel', () =>
    gulp.src('sites/all/themes/markone/src/babel-scripts/*.js')
        .pipe(babel())
        .pipe(concat('babel-scripts.js'))
        .pipe(gulp.dest('sites/all/themes/markone/src/scripts/'))
);
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...