Django TypeScript Compressor

I want Django Compressor to work with the new Microsoft TypeScript language.

I downloaded the tsc compiler and it works great.

When trying to use it with a Django compressor as follows:

 COMPRESS_PRECOMPILERS = ( ('text/less', 'lessc {infile} {outfile}'), ('text/typescript', 'tsc {infile} {outfile}'), ) 

and

 {% compress js %} <script type="text/typescript" charset="utf-8"> var x=3; function greeter(person: string) { return "Hello, " + person; } var user = "Jane User"; </script> {% endcompress %} 

the output is an empty JS script tag

 <script type="text/javascript"></script> 

I think this is because there is no way in tsc to write code to a predefined file.

Does anyone have any ideas?

(As said, tsc works, as well as a django compressor for LESS ..)

+4
source share
1 answer

tsc file1.ts file2.ts compiles file1.ts and file2.ts into files file1.js and file2.js respectively.

 > tsc.exe Syntax: tsc [options] [file ..] Examples: tsc hello.ts tsc --out foo.js foo.ts tsc @args.txt 

Looks like you want to run tsc {infile} --out {outfile}

+2
source

Source: https://habr.com/ru/post/1439466/


All Articles