explaingit

jashkenas/coffeescript

16,577CoffeeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

CoffeeScript is a small programming language that compiles to plain JavaScript, write more expressive, cleaner syntax and get valid JS output that runs anywhere JavaScript runs, including Node.js and browsers.

Mindmap

mindmap
  root((repo))
    What it does
      Compiles to JavaScript
      Cleaner syntax
      Runs anywhere JS runs
    How to use
      npm install
      coffee command
      Compile with -c flag
    Use cases
      Node.js scripting
      Browser JS authoring
      Existing JS projects
    Audience
      JavaScript developers
      Node.js users
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Write a Node.js script in CoffeeScript syntax and compile it to JavaScript for deployment without changing your runtime.

USE CASE 2

Add CoffeeScript to an existing project via npm so your team can author in CoffeeScript while shipping standard JS files.

USE CASE 3

Run a CoffeeScript file directly with the coffee command during development, skipping the compile step entirely.

Tech stack

CoffeeScriptJavaScriptNode.jsnpm

Getting it running

Difficulty · easy Time to first run · 5min
License information is not mentioned in the explanation.

In plain English

CoffeeScript, described in its own README as "a little language that compiles into JavaScript" and in its tagline as "unfancy JavaScript", is a programming language whose source files are translated by a compiler into ordinary JavaScript code that can then run anywhere JavaScript runs. The tool is installed through npm, either locally to a single project or globally so the coffee command is available everywhere, and it requires Node.js. Once installed, the coffee command can either run a .coffee script directly or compile it into a .js file with the -c flag. Someone would use it if they prefer CoffeeScript's syntax over plain JavaScript but still need standard JavaScript as the final output. The full documentation and examples live at coffeescript.org.

Copy-paste prompts

Prompt 1
I prefer CoffeeScript syntax over plain JavaScript. Show me how to install jashkenas/coffeescript globally via npm and compile a hello-world .coffee file to .js.
Prompt 2
What are the most useful CoffeeScript features compared to modern JavaScript? Give me side-by-side examples of classes, arrow functions, and destructuring in both languages.
Prompt 3
I have a Node.js project and want to add CoffeeScript support. Show me how to install it as a dev dependency and set up an npm build script that compiles all .coffee files to a dist/ folder.
Prompt 4
How do I run a CoffeeScript file directly without compiling it first, and how do I pass command-line arguments to it?
Open on GitHub → Explain another repo

← jashkenas on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.