In my project I'm having a src and a dist folder. In src are all the ts, json and css files.
In the tsconfig I specified the outDir to be dist. Is it know possible to copy all the json and css files also to the dist folder (like in Babel with the --copy-files parameter)?
The fs. copyFile() method is used to asynchronously copy a file from the source path to destination path. By default, Node. js will overwrite the file if it already exists at the given destination.
It is not possible. Typescript's philosophy is to do one thing and do it well. This is relegated to transpiling Typescript to Javascript. The project has also denied requests to add source code formatting controls because there are other tools that handle that better. What this means is that if you need anything outside of transpiling, you will need a workflow to handle the other functionality/needs.
You can use tools like gulp/grunt to tailor your building process to your needs.
For example, using gulp task to copy all non ts files can look like this:
gulp.task('build.copy.assets',
function()
{
return gulp.src(['./src/**/*', '!./**/*.ts'])
.pipe(gulp.dest('dist'));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With