Compile and run Coffeescript in Sublime Text 2

Was anyone lucky to compile and run CoffeeScript files in Sublime Text 2 with the TextMate package https://github.com/jashkenas/coffee-script-tmbundle

CoffeeScript.sublime builds

{ "path": "/usr/local/bin", "cmd": ["coffee","$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.coffee" } 

Anyway, to compile and compile selected text commands in Sublime Text 2?

+6
source share
4 answers

Several assemblies were added in 2197 http://www.sublimetext.com/forum/viewtopic.php?f=2&t=7180

+7
source

If with โ€œmultiple build commandsโ€ you want to pass different compilation options to CoffeeScript, you can check this blog post to see how I did it:

http://hectorcorrea.com/Blog/Compiling-CoffeeScript-from-Sublime-Text-2

Basically, I implemented the use of the same approach as you (via the Build menu), and the rest, which I had to implement using plugins.

A response from @atomi indicates that this will be supported soon, which would be very nice.

+2
source

The setup here looks pretty promising. Obviously, you can attach a key combination to a command, in this case just start the coffee in the file.

http://soenkerohde.com/2011/11/coffeescript-with-sublime-text/

+1
source

I found that using Node on OSX I need the @Hector answer option.

I created a new CoffeeScriptRun.sublime-build file (Tools> Build System> New Build System), which looked like this:

 { "cmd": ["coffee", "$file"], "selector" : "source.coffee", "path" : "/Users/derekhill/.nvm/v0.10.35/bin" } 

This path is the directory from which node (i.e. without the "node" at the end)

The Wes Bos blog post then provided a useful explanation of what each piece means:

  • cmd is an array of commands to be run.
  • selector is an optional way to combine a script assembly into a specific file type
  • path - the command in which the command should be executed. Since Sublime runs it in the python console, we need to indicate where on our system the compiler we want to use is false.

So basically this is equivalent to going to the Node directory and coffee my_file.coffee works

0
source

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


All Articles