I am using regex type glob to include files in gulp. How can I use a regex to ignore strings that end with a ".d.ts" but include all others?
Already I have this:
"app/*.*"
but it's including filenames with any ending.
Is there a way I can limit it to just those not ending in .d.ts? So for example these would be okay:
app/abc.html
app/abc.js
app/abc.ts
But this would not
app/abc.d.ts
In your src
definition, you can use bang (!
) to exclude paths, like:
gulp.src(['path/to/src/**/*.*', '!path/to/src/**/*.d.ts'])
The minimatch documentation discusses the bang syntax.
Just noticed this related question has additional details.
.*(?<!\.d\.ts)$
Debuggex Demo
(assuming lookbehind assertions are supported by your regex flavor. I dont know "gulp")
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