Created
January 5, 2015 17:58
-
-
Save spboyer/6d0f1eec32d8446f9138 to your computer and use it in GitHub Desktop.
Simple example for using gulp.js to compile TypeScript
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 gulp = require('gulp'), | |
tsc = require('gulp-tsc'), | |
shell = require('gulp-shell'), | |
seq = require('run-sequence'), | |
del = require('del'); | |
var paths = { | |
ts: { | |
src: [ | |
'scripts/ts/*.ts' | |
], | |
dest : 'scripts/' | |
} | |
} | |
// Default | |
gulp.task('default', ['build']); | |
// Clean | |
gulp.task('clean', function (cb) { | |
del(paths.ts.dest + '/*.js', cb); | |
}) | |
// Build | |
gulp.task('build', function () { | |
return gulp | |
.src(paths.ts.src) | |
.pipe(tsc({ | |
module: "CommonJS", | |
sourcemap: true, | |
emitError: false | |
})) | |
.pipe(gulp.dest(paths.ts.dest)); | |
}); | |
// ReBuild - Clean & Build | |
gulp.task('rebuild', function (cb) { | |
seq('clean', 'build', cb); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment