const gulp = require('gulp'); const presetES2015 = require("@joepie91/gulp-preset-es2015"); const presetPegjs = require("@joepie91/gulp-preset-pegjs") let sources = { babel: ["src/**/*.js"], pegjs: ["src/**/*.pegjs"] } gulp.task('babel', function() { return gulp.src(sources.babel) .pipe(presetES2015({ basePath: __dirname })) .pipe(gulp.dest("lib/")); }); gulp.task('pegjs', function() { return gulp.src(sources.pegjs) .pipe(presetPegjs({ basePath: __dirname })) .pipe(gulp.dest("lib/")); }) gulp.task('watch', function () { gulp.watch(sources.babel, ['babel']); gulp.watch(sources.pegjs, ['pegjs']); }); gulp.task('default', ['pegjs', 'babel', 'watch']);