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

Compiling our source with Grunt


In our development environment, we can get away with having our browser compile our CoffeeScript. In production, however, this introduces an unwelcomed decrease in performance. In this section, we will use a tool called Grunt to prepare our source for production by compiling the CoffeeScript into JavaScript as well as combining and minifying our code into a single source file.

Grunt is a task runner similar to Rake for Ruby developers, Ant for Java developers, or NAnt for .NET developers.

In this section, we will use Grunt to compile our CoffeeScript and concatenate it into a single JavaScript file better suited to be used by our application in production.

Getting ready

The first step is to install Grunt. Grunt comes as two NPM packages.

First is the Grunt library. This can be installed locally in our project's folder using the following command:

> npm install grunt

Next, we need to install the Grunt command-line client tool into our global NPM package repository...