5

I want to write TypeScript and CoffeeScript in the Brackets code editor, but I am having difficulties. How do I compile it to vanilla js? How to refer it in the html page?

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
user3793458
  • 53
  • 1
  • 4
  • 1
    Seems clear to me. He's asking how to compile TypeScript or CoffeeScript files to vanilla js from within the Brackets code editor.Maybe he's installed the brackets-typescript extension and has noticed it doesn't provide a "compile" button, or an option in the menus or any other obvious way of compiling, The github page for brackets-typescript refers you to the "How To Use Brackets Guide" - which says nothing about TypeScript/CoffeeScript, and the only thing it says about compilation is that extensions or third-party file watchers can be used to automatically recompile SCSS/LESS files on save. – MTGradwell Jan 02 '16 at 12:35

1 Answers1

10

For TypeScript

intellisence / syntax highlighting / live error checking

You need the brackets-typescript plugin : https://github.com/fdecampredon/brackets-typescript

Compile to vanilla JS

You can use grunt to do that for you : https://github.com/grunt-ts/grunt-ts. It can compile your project whenever you save a file in brackets (or any other editor). The output is JavaScript

How to refer it in the html page

You point to the generated JS with a normal script tag as you do if you were just using JavaScript to begin with.

Alternatively you can use something like RequireJS http://requirejs.org/

Community
  • 1
  • 1
basarat
  • 261,912
  • 58
  • 460
  • 511