import gulp from 'gulp'; import babel from 'gulp-babel'; import del from 'del'; import webpack from 'webpack-stream'; import webpackConfig from './webpack.config.babel'; const paths = { allSrcJs: 'src/**/*.js?(x)', jsSrc: 'src/public/js/app.js', jsDistDir: 'build/public/js', imgSrc: 'src/public/img/*', imgDest: 'build/public/img/', htmlSrc: 'src/public/index.html', htmlDest: 'build/public/', gulpFile: 'gulpfile.babel.js', webpackFile: 'webpack.config.babel.js', }; gulp.task('images', () => gulp.src(paths.imgSrc) .pipe(gulp.dest(paths.imgDest)) ); gulp.task('html', () => gulp.src(paths.htmlSrc) .pipe(gulp.dest(paths.htmlDest)) ); gulp.task('js', () => gulp.src(paths.jsSrc) .pipe(webpack(webpackConfig)) .pipe(gulp.dest(paths.jsDistDir)) ); gulp.task('main', ['images', 'html', 'js']) gulp.task('watch', () => { gulp.watch(paths.allSrcJs, ['js']); gulp.watch(paths.imgSrc, ['images']); gulp.watch(paths.htmlSrc, ['html']); }); gulp.task('default', ['watch', 'main']);