Question

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

I downloaded the compiler tsc and it works fine.

When trying to use it with Django Compressor this way:

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 guess it is because the tsc program does not have the option to write the code to a predefined file.

Does someone have an idea?

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

Was it helpful?

Solution

tsc file1.ts file2.ts compiles file1.ts and file2.ts into 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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top