I'm working on a Typescript project, and I am trying to implement Gulp.
In my src/
folder, I have files with different extensions.
I've configured Gulp to transpile every *.ts
file to Javascript using Babel, and to output the type-definition files using the Typescript compiler.
I would like all other files to be copied to the dist/
folder.
const {
dest,
src
} = require("gulp");
function cp() {
return src("src/**/*.*", "!(src/**/*.ts)")
.pipe(dest("./dist"));
};
exports.cp = cp;
I would like the cp
function to copy every file except those with a .ts
extension to the dist/
folder.
The above code works if I define the extensions that I want to copy and avoid using the wildcard extension. I've found many examples online, but they are usually not using a wildcard extension. I'm not sure if the problem comes from my negation or from the usage of a wildcard extension. Is there any way to do this?
Many thanks!
Found it!
The solution was written black on white in the official documentation of the src() method. Here is the fix:
const {
dest,
src
} = require("gulp");
function cp() {
return src(["src/**/*.*", "!src/**/*.ts"])
.pipe(dest("./dist"));
};
exports.cp = cp;