Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript asset manager

I use node.js connect/express.

Does anyone know an assets manager that supports on the fly compilation and minification of TypeScript source code?

Any idea how to call the compiler programmatically?

I've been using connect-assets which is build on top of Snockets. Shouldn't be that hard to implement once I figure how to compile a .ts resource.

like image 829
Olivier Refalo Avatar asked Dec 13 '25 19:12

Olivier Refalo


2 Answers

From reading through the tsc.js code, it looks like there's a TypeScript.TypeScriptCompiler(outfile, errout, new TypeScript.NullLogger(), this.compilationSettings); function you could hook into. The code is on Codeplex, under an Apache license, and it's modular. Since TypeScript can be compiled to target CommonJS modules, it should be fairly straightforward to hack it into express.

like image 113
Jason Suárez Avatar answered Dec 15 '25 09:12

Jason Suárez


Not a complete answer yet, but I found this project: which exposes the TypeScript compiler.

https://bitbucket.org/nxt/node-typescript-wrapper

like image 44
Olivier Refalo Avatar answered Dec 15 '25 10:12

Olivier Refalo