Created
February 4, 2016 07:43
-
-
Save img/bd702ea071074372c589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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