Configuring TypeScript Sublime without explicitly defining every file path
-
20-12-2019 - |
Question
Working with TypeScript and Sublime Text 3 using the T3S package. I'd like my NodeJS project to be structured like so:
/web.js
/views/some-view.js
/controllers/some-controller.js
[...]
/src
/src/web.ts
/src/views/some-view.ts
/src/controllers/some-controller.ts
In other words, I want all my .ts
to be under /src
and compile to individual .js
files under /
.
How can I configure T3S to compile my .ts
files like this, without explicitly defining each and every .ts
file in my sublime-project
file?
If I cannot use T3S's build system to accomplish this, then is there a way to disable T3S's build system? Instead I'd make a Ruby filesystem watcher and compile every time a file is changed.
Solution
Instead I'd make a Ruby filesystem watcher and compile every time a file is changed.
There are already plenty of grunt plugins for TypeScript. E.g. grunt-ts
. The option you need is --outDir
: https://github.com/grunt-ts/grunt-ts#compiler-support