HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

coffee — Execute CoffeeScript scripts or compiles them into JavaScript. More information: <https://coffeescri

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandcoffeescriptexecuteclithemcoffeescriptscompiles

Problem

How to use the coffee command: Execute CoffeeScript scripts or compiles them into JavaScript. More information: <https://coffeescript.org#cli>.

Solution

coffee — Execute CoffeeScript scripts or compiles them into JavaScript. More information: <https://coffeescript.org#cli>.

Run a script:
coffee {{path/to/file.coffee}}


Compile to JavaScript and save to a file with the same name:
coffee --compile {{path/to/file.coffee}}


Compile to JavaScript and save to a given output file:
coffee --compile {{path/to/file.coffee}} --output {{path/to/file.js}}


Start a REPL (interactive shell):
coffee --interactive


Watch script for changes and re-run script:
coffee --watch {{path/to/file.coffee}}

Code Snippets

Run a script

coffee {{path/to/file.coffee}}

Compile to JavaScript and save to a file with the same name

coffee --compile {{path/to/file.coffee}}

Compile to JavaScript and save to a given output file

coffee --compile {{path/to/file.coffee}} --output {{path/to/file.js}}

Start a REPL (interactive shell)

coffee --interactive

Watch script for changes and re-run script

coffee --watch {{path/to/file.coffee}}

Context

tldr-pages: common/coffee

Revisions (0)

No revisions yet.