RubyMine 7.0.1 Web Help

CoffeeScript code is not processed by browsers that work with JavaScript code. Therefore to be executed, CoffeeScript code has to be translated into JavaScript. This operation is referred to as transpilation and the tools that perform it are called transpilers.

For more details about transpilation in RubyMine, see the section Using File Watchers.

There are two approaches to running CoffeeScript in RubyMine:

  • Transpile the CoffeeScript code manually and then run the output JavaScript code as if it were a Node.js application.
  • Run the original CoffeeScript code through the NodeJS run configuration and have RubyMine transpile it on the fly.

In either case, running CoffeeScript is supported only in the local mode. This means that RubyMine itself starts the Node.js engine and the target application according to a run configuration and gets full control over the session.

For more details about running Node.js applications, see Running and Debugging Node.js.

Transpiling CoffeeScript manually and running the output as a Node.js application
  1. Transpile the CoffeeScript code into Javascript.
  2. Start creating a Node.js run configuration with the following mandatory settings:
    1. The Node.js engine to use. By default, the field shows the path to the interpreter specified on the Node.js page during Node.js configuration.
    2. In the Working directory field, specify the location of the files referenced from the starting CoffeeScript file to run, for example, includes. If this file does not reference any other files, just leave the field empty.
    3. In the Path to Node App JS File text box, specify the full path to the JavaScript file that was generated from the original CoffeeScript file during the transpilation.
  3. Save the configuration and click run.png on the toolbar.
  4. Proceed as while running a Node.js application.
Transpiling CoffeeScript on the fly
  1. Start creating a Node.js run configuration with the following mandatory settings:
    1. The Node.js engine to use. By default, the field shows the path to the interpreter specified on the Node.js page during Node.js configuration.

      For Unix and OS X, this setting is overridden by the Node.js from the path to the CoffeeScript transpiler executable file.

    2. In the Working directory field, specify the location of the files referenced from the starting CoffeeScript file to run, for example, includes. If this file does not reference any other files, just leave the field empty.
    3. In the Path to Node App JS File text box, specify the full path to the CoffeeScript file to run.
    4. Select the Run with CoffeeScript plugin check box and specify the location of the CoffeeScript transpiler executable file to use.

      This file is normally located under the Node.js. For Unix and OS X, this setting overrides the Path to Node.

  2. Save the configuration and click run.png on the toolbar.
  3. Proceed as while running a Node.js application.

See Also

Concepts:

Procedures:

Reference:

Web Resources: