Yar*_*nST 5 javascript django django-compressor typescript
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}'),
)
Run Code Online (Sandbox Code Playgroud)
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 %}
Run Code Online (Sandbox Code Playgroud)
the output is an empty JS script tag
<script type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
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..)
tsc file1.ts file2.ts将 file1.ts 和 file2.ts 分别编译为 file1.js 和 file2.js。
> tsc.exe
Syntax: tsc [options] [file ..]
Examples: tsc hello.ts
tsc --out foo.js foo.ts
tsc @args.txt
Run Code Online (Sandbox Code Playgroud)
看来你想跑tsc {infile} --out {outfile}