Hi,
I would like to type in Typescript, so i tried adding it to the gulpfile.js but i cant get it to merge with the default bower javascript. My understanding of gulp files in general is low so maby iam just not seeing something obvious, but i would like some help.
This is what i have now:
gulpfile.js
gulp.task('typescript', function() {
var tsProject = ts.createProject('tsconfig.json');
return tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest(''))
.pipe(browserSync.stream());
});
manifest.json
{
“dependencies”: {
“main.js”: {
“files”: [
“scripts/main.js”,
“scripts/typescript_DO_NOT_EDIT.js”
],
“main”: true
},
the gulpfile makes a new js file named “typescript_DO_NOT_EDIT.js” in my assets/script. So that the default gulp script handeler can compile it. The problem with this is that it really ugly and my sourcemap doesn’t work. Do you how i can “inject” my typescript in the normal script flow? That it will only output a single main.js file with all the bower_components, manifest stuff and working sourcemaps?