I want to have a gulpfile that first converts my es6 code to es5 and saves it to one directory, then scrolls it (to each file, not just the recording file) and saves it in another directory, and finally I want to minimize it and place it in the browser as .min.js files. Here is the diagram on which the result should look:
src/
es6/
index.js
mod.js
es5/
index.js
mod.js
es5-browser/
index.js
index.min.js
mod.js
mod.min.js
Here is my gulpfile so far, but I keep getting can not find the module error:
var gulp = require('gulp');
var traceur = require('gulp-traceur');
var browserify = require('gulp-browserify');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('es5ize', function () {
return gulp.src('src/es6/**/*.js')
.pipe(sourcemaps.init())
.pipe(traceur({sourceMaps: true}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('src/es5'))
.pipe(browserify({
debug : true
}))
.pipe(gulp.dest('src/es5-browser'))
;
});
I know that I should not use gulp-browsererify, but I could not get anything like this to work with vinyl.
It works up to the browser stage
How can I make this work?
EDIT:
I want to be able to save this in gulp and not do anything, because in the end I will also want to use Watchify for this
, , , , , , , . , , , glob ,