A48
A48

Reputation: 29

Laravel Elixir use Typescript instead of Javascript

I have a project that uses laravel 5.2 here I use laravel elixir for javascript pre-processors and I find that the typescript is easier to use because it is object-oriented and can also be compiled into Javascript, the question is can I combine Javascript and typescript using laravel Elixir? is there a library that can do that?

mix.script(['jquery.js', 'app.ts'], 'all.js']);

Thanks :)

Upvotes: 1

Views: 1300

Answers (1)

basarat
basarat

Reputation: 275997

Since it doesn't support TypeScript out of the box : https://laravel.com/docs/5.2/elixir#babel recommend just running tsc -w -p ./example/tsconfig.json and using the .js output as it is in mix.script.

You can even use concurrently to run both tsc -w with other tasks : https://www.npmjs.com/package/concurrently

Upvotes: 2

Related Questions