Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring your environment and tools


One significant aspect to being a productive CoffeeScript developer is having a proper development environment. This environment typically consists of the following:

  • Node.js and the NPM

  • CoffeeScript

  • Code editor

  • Debugger

In this recipe, we will look at installing and configuring the base components and tools necessary to develop CoffeeScript applications.

Getting ready

In this section, we will install the software necessary to develop applications with CoffeeScript.

One of the appealing aspects of developing applications using CoffeeScript is that it is well supported on Mac, Windows, and Linux machines. To get started, you need only a PC and an Internet connection.

How to do it...

CoffeeScript runs on top of Node.js—the event-driven, non-blocking I/O platform built on Chrome's JavaScript runtime. If you do not have Node.js installed, you can download an installation package for your Mac OS X, Linux, and Windows machines from the start page of the Node.js website (http://nodejs.org/).

To begin, install Node.js using an official prebuilt installer; it will also install the NPM.

Next, we will use NPM to install CoffeeScript. Open a terminal or command window and enter the following command:

npm install -g coffee-script

This will install the necessary files needed to work with CoffeeScript, including the coffee command that provides an interactive Read Evaluate Print Loop (REPL)—a command to execute CoffeeScript files and a compiler to generate JavaScript.

It is important to use the -g option when installing CoffeeScript, as this installs the CoffeeScript package as a global NPM module. This will add the necessary commands to our path.

Tip

On some Windows machines, you might need to add the NPM binary directory to your path. You can do this by editing the environment variables and appending ;%APPDATA%\npm to the end of the system's PATH variable.