Advertisement
private775

Gulp file for TypeScript

Oct 13th, 2015
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var gulp = require('gulp');
  2. var sass = require('gulp-sass');
  3. var sourcemaps = require('gulp-sourcemaps');
  4. var handlebars = require('gulp-compile-handlebars');
  5. var rename = require('gulp-rename');
  6. var concat = require('gulp-concat');
  7.  
  8. var ts = require('gulp-typescript');
  9.  
  10. var buildDir = "build";
  11. var jsDir = buildDir + "/js";
  12. var compilerOptions = {
  13.     "module": "commonjs",
  14.     "target": "ES3",
  15.     "noImplicitAny": true,
  16.     "removeComments": true,
  17.     "preserveConstEnums": true,
  18.     "sortOutput ": true
  19. };
  20.  
  21.  
  22.  
  23. gulp.task('typescript-compile', function(){
  24.     var tsResult = gulp.src('TS/*.ts')
  25.                        .pipe(sourcemaps.init()) // This means sourcemaps will be generated
  26.                        .pipe(ts(compilerOptions));
  27.    
  28.     return tsResult.js
  29.                 .pipe(concat('weeklycal.js')) // You can use other plugins that also support gulp-sourcemaps
  30.                 .pipe(sourcemaps.write("./")) // Now the sourcemaps are added to the .js.map file
  31.                 .pipe(gulp.dest(jsDir));});
  32.  
  33. gulp.task('default',['typescript-compile']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement