javascript - TypeScript - How to keep compiled files in a separate directory? -
i'm new typescript, , right have .ts files in several places throughought project structure:
app/ |-scripts/ |-app.ts | |-classes/ | |-classa.ts | |-classb.ts | |-controllers/ | |-controllera.ts | |-controllerb.ts | |-otherstuff/ |-otherstuffa.ts
right now, when files compiled, compiled same directory .ts fles in:
app/ |-scripts/ |-app.ts |-app.js | |-classes/ | |-classa.ts | |-classb.ts | |-classa.js | |-classb.js | |-controllers/ | |-controllera.ts | |-controllerb.ts | |-controllera.js | |-controllerb.js | |-otherstuff/ |-otherstuffa.ts |-otherstuffa.js
while way .js files keep same directory structure .ts files, don't want track .js files in vcs, i'd keep of javascript files in separate directory tree (that can add .gitignore), so:
app/ |-scripts/ | |-app.ts | | | |-classes/ | | |-classa.ts | | |-classb.ts | | | |-controllers/ | | |-controllera.ts | | |-controllerb.ts | | | |-otherstuff/ | |-otherstuffa.ts | |-js/ |-app.js | |-classes/ | |-classa.js | |-classb.js | |-controllers/ | |-controllera.js | |-controllerb.js | |-otherstuff/ |-otherstuffa.js
is there setting or option somewhere tell typescript compiler this? also, i'm not sure if it's relevant, using webstorm.
use option --outdir
on tsc (configured within file watcher in intellij)
from command line documentation
--outdir directory redirect output structure directory.
edit
since typescript 1.5, can set in tsconfig.json
file:
"compileroptions": { "outdir": "directory" ...
Comments
Post a Comment