Skip to content

Instantly share code, notes, and snippets.

@img
Created February 4, 2016 07:43
Show Gist options
  • Save img/bd702ea071074372c589 to your computer and use it in GitHub Desktop.
Save img/bd702ea071074372c589 to your computer and use it in GitHub Desktop.
var plumber = require("gulp-plumber");
var through = require("through2");
var gutil = require("gulp-util");
var gulp = require("gulp");
var babel = require("gulp-babel");
var watch = require("gulp-watch");
var scripts = "./src/**/*.js";
var dest = "build";
var srcEx, libFragment;
gulp.task("default", ["build"]);
gulp.task("build", function () {
return gulp.src(scripts, {base: "."})
.pipe(watch(scripts))
.pipe(plumber({
errorHandler: function (err) {
gutil.log(err.stack);
}
}))
/* .pipe(through.obj(function (file, enc, callback) {
file._path = file.path;
file.path = file.path.replace(srcEx, libFragment);
callback(null, file);
}))
.pipe(through.obj(function (file, enc, callback) {
gutil.log("Compiling", "'" + chalk.cyan(file._path) + "'...");
callback(null, file);
}))
*/
.pipe(babel())
.pipe(gulp.dest(dest));
});
gulp.task("watch", ["build"], function (callback) {
watch(scripts, function () {
gulp.start("build");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment