How do you write Gulp tasks in TypeScript?
I've seen projects like this where they write gulp tasks in TypeScript so I know it is possible, but I'm having a hard time finding out how they set this up.
If you just want a task that runs some function, then just do that: gulp. task('my-custom-task', function () { myCustomFunction('foo', 'bar'); });
A gulp plugin for handling TypeScript compilation workflow. The plugin exposes TypeScript's compiler options to gulp using TypeScript API. This plugin works best with gulp 4.
You can write a gulpfile using a language that requires transpilation, like TypeScript or Babel, by changing the extension on your gulpfile. js to indicate the language and install the matching transpiler module. For TypeScript, rename to gulpfile. ts and install the ts-node module.
Gulp vs Grunt: Speed The reason for Gulp's current speed advantage is down to the fact that Gulp uses streams and handles tasks in memory, which means that only one file is written. Furthermore, Gulp can process several tasks at the same time, but Grunt will normally only handle one task at a time.
Ok, after a bit a digging and dicing this project up I found it.
To run gulpfile.ts without compiling the file you can use the 'ts-node' package. This package lets you run TypeScript directly in node and in this case you can use it to run gulp which will compile and run TypeScript on the fly while running your gulp tasks.
I didn't mean to answer my own question but it you find it you might as well share it.
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