Skip to content

Instantly share code, notes, and snippets.

@knrt10
Created December 26, 2018 07:55
Show Gist options
  • Select an option

  • Save knrt10/c0662c9c750bc409ea9924b841bf87a6 to your computer and use it in GitHub Desktop.

Select an option

Save knrt10/c0662c9c750bc409ea9924b841bf87a6 to your computer and use it in GitHub Desktop.
Gulpfile for minifying code from TS to JS
const gulp = require("gulp");
const ts = require("gulp-typescript");
const sourcemaps = require("gulp-sourcemaps");
const tsProject = ts.createProject("tsconfig.json", {
typescript: require("typescript")
});
gulp.task("build", () => {
gulp.src("process.yml")
.pipe(gulp.dest("dist"));
return tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.js
.pipe(sourcemaps.write())
.pipe(gulp.dest("dist"));
});
gulp.task("watchTask", function () {
gulp.watch("src/**/*.ts", ["build"]);
});
gulp.task("default", gulp.series("build"));
gulp.task("watch", gulp.series("build", "watchTask"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment