Skip to content

Instantly share code, notes, and snippets.

@spboyer
Created January 5, 2015 17:58
Show Gist options
  • Save spboyer/6d0f1eec32d8446f9138 to your computer and use it in GitHub Desktop.
Save spboyer/6d0f1eec32d8446f9138 to your computer and use it in GitHub Desktop.
Simple example for using gulp.js to compile TypeScript
{
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