Skip to content

Instantly share code, notes, and snippets.

@MayakoAelys
Created March 22, 2018 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MayakoAelys/9d377fb99411d107c619162b23f1a6e6 to your computer and use it in GitHub Desktop.
Save MayakoAelys/9d377fb99411d107c619162b23f1a6e6 to your computer and use it in GitHub Desktop.
TS -> JS + MAP, using gulp, gulp-typescript (without bundling)
var ts = require('gulp-typescript');
var destJS = './www/dist/js';
var srcTS = './src/ts';
// TS to JS (without bundling)
// gulp task allowing Typescript debug when JS files are transpiled in another folder
// ref.: https://www.npmjs.com/package/gulp-typescript
gulp.task('tsc', function(){
gutil.log("=====================");
gutil.log("TypeScript --> JavaScript (other files)");
gutil.log("=====================");
return gulp.src(['./src/ts/**/*.ts', '!./ts/main.ts']) // Exclude the main file (see tsc-main task) (unused finally)
.pipe(srcmaps.init())
.pipe(ts({
target: "ES5",
module: "commonjs",
moduleResolution: "node",
lib:[
"dom",
"es2015",
"es2015.iterable"]
}))
.pipe(srcmaps.write('./', {
destPath: destJS,
//destPath: destES5,
base: srcTS
}))
.pipe(gulp.dest(destJS));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment