import gulp from 'gulp'; import babel from 'gulp-babel'; import less from 'gulp-less'; import del from 'del'; import webpack from 'webpack-stream'; import webpackConfig from './webpack.config.babel'; const paths = { jsSrc: 'src/public/js/app.js', jsDistDir: 'build/public/js', lessSrc: 'src/public/less/app.less', lessDest: 'build/public/css', fontSrc: [ './node_modules/font-awesome/fonts/*', './node_modules/bootstrap/fonts/*', ], fontDest: 'build/public/fonts', imgSrc: 'src/public/img/*', imgDest: 'build/public/img/', goTemplatesSrc: 'src/templates/**/*.tmpl', goTemplatesDest: 'build/templates/', gulpFile: 'gulpfile.babel.js', webpackFile: 'webpack.config.babel.js', }; gulp.task('less', () => gulp.src(paths.lessSrc) .pipe(less({ paths: [ './node_modules' ] })) .pipe(gulp.dest(paths.lessDest)) ); gulp.task('fonts', () => gulp.src(paths.fontSrc) .pipe(gulp.dest(paths.fontDest)) ); gulp.task('images', () => gulp.src(paths.imgSrc) .pipe(gulp.dest(paths.imgDest)) ); gulp.task('go-templates', () => gulp.src(paths.goTemplatesSrc) .pipe(gulp.dest(paths.goTemplatesDest)) ); gulp.task('main', ['less', 'fonts', 'images'], () => gulp.src(paths.jsSrc) .pipe(webpack(webpackConfig)) .pipe(gulp.dest(paths.jsDistDir)) ); gulp.task('watch', () => { gulp.watch(paths.jsSrc, ['main']); gulp.watch(paths.gulpFile, ['main']); gulp.watch(paths.lessSrc, ['less']); gulp.watch(paths.imgSrc, ['images']); gulp.watch(paths.goTemplatesSrc, ['go-templates']); }); gulp.task('default', ['watch', 'main']);