0

I have a folder with many subfolders and these subfolder have many subfolders. Is there a way to transform all the ES6 files into ES5 with a command from the root?

The approach I have is:

var gulp = require('gulp');
var babel = require('gulp-babel');

gulp.task('transform', function () {
return gulp.src('folder/**/**/**/**/**/*.js')
    .pipe(babel())
    .pipe(gulp.dest('folder/compiled'));
});

gulp.task('watch', function() {
gulp.watch('folder/**/**/**/**/**/*.js', ['transform'])
});

gulp.task('default', ['watch']);
  • In order to get as accurate as possible responses, do you have any script to share your current attempt or how you'd expect to implement this? – alariva Aug 05 '18 at 00:22
  • @alariva it has been edited the question with the approach I have. – Victor Sanchez Aug 05 '18 at 00:38
  • Cool, so I guess that's not working and you want to know how to correctly transform all the files recursively? Looks like maybe [this question](https://stackoverflow.com/questions/21689334/gulp-globbing-how-to-watch-everything-below-directory) helps on this. – alariva Aug 05 '18 at 00:41
  • Yes, now works good, but now I have another problem. When it compiles, as it is watching, it creates a compiled folder inside a compile folder...and so on in every change @alariva – Victor Sanchez Aug 05 '18 at 00:50
  • Possible duplicate of [gulp globbing- how to watch everything below directory](https://stackoverflow.com/questions/21689334/gulp-globbing-how-to-watch-everything-below-directory) – alariva Aug 05 '18 at 00:53
  • In order to keep clean and consistent content in StackOverflow, please proceed to open a new question that targets your specific problem. Provide as much and clear information to help others understand your problem and provide you with proper help. – alariva Aug 05 '18 at 00:54

0 Answers0