Skip to content

Instantly share code, notes, and snippets.

@DanielFGray
Last active August 29, 2015 14:24
Show Gist options
  • Save DanielFGray/e85ca689ac100544bf2a to your computer and use it in GitHub Desktop.
Save DanielFGray/e85ca689ac100544bf2a to your computer and use it in GitHub Desktop.
"use strict";
var gulp = require("gulp"),
sourcemaps = require("gulp-sourcemaps"),
babel = require("gulp-babel"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
rename = require("gulp-rename"),
del = require("del");
gulp.task("js", function() {
return gulp.src("src/**/*.js")
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(concat("main.js"))
.pipe(babel())
.pipe(gulp.dest("dist"))
.pipe(rename({ suffix: ".min" }))
.pipe(uglify())
.pipe(sourcemaps.write("./", { includeContent: false }))
.pipe(gulp.dest("dist"));
});
gulp.task("resources", ["js"]);
gulp.task("clean", function(cb) {
del(["dist/*"], cb);
});
gulp.task("default", ["clean"], function() {
gulp.start("resources");
});
gulp.task("watch", function() {
gulp.watch("src/**/*.js", ["default"]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment