Compiling a Node Project with Grunt

In the previous chapter, we used Grunt to compile our CoffeeScript files into JavaScript (and source maps) to be served to the browser. For this chapter’s project, we’ll have two kinds of CoffeeScript files: files that define JavaScript to be sent to the browser, and files that should be run locally in Node. So we’ll keep them in two separate directories, /assets and /src. We’ll use our Node server to serve our compiled assets to the browser. Any time any of our files change, we’ll restart the Node server to ensure that it reflects our changes.

We’ll keep our assets that don’t have to be compiled (our CSS and HTML files, as well as the external JS we’ll install through Bower) in the assets directory as well, ...

Get CoffeeScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.