R3Tech R3Tech - 3 months ago 27
TypeScript Question

compiling typescript and keep directory structure correctly

I have a build and a src dir. And in my src dir with my public folder where all my css's, assets and html's and the server folder with all server files. And now for an example in my server.ts I use a view in

public/html
. And if I transpiling my code in the build folder only the .ts files are and then the server.js tries to find the view in
cmpl/public/html
...

What is now a good way to transpiling the full src folder to build? Can Gulp this? Or TSC directly?

Greetz

Answer

You can just copy your html files to cmpl directory:

gulp.task('copyHtml', function () {
  return gulp
    .src('public/html/**/*.html')
    .pipe(gulp.dest('cmpl'));
});
Comments