Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a fantastic slide deck. The per slide comments below are great too. Particularly on an iPhone as you read them simultaneously.

We've been using CoffeeScript for a bit over a year now and never looked back. All of our front end code is written in CS and I can't imagine writing JS again. It's just objectively better. Less code to write, easier to read, minimal cruft, and a joy to use.

The only hiccup was getting the compilation integrated into the build process. We handle it with direct loading of the CS files while working locally with coffescript.js loaded as well. That way code changes are available as soon as you refresh the page. Our build script for the app (when packaging it up for staging/prod) pre compiles the CS files so there's no compilation lag in prod.

I've been experimenting with node.js for a side project and its pretty easy to setup a project entirely in CS. There's a pretty good template with CoffeeScript/Express/Mongoose to use as a template here: https://github.com/olafurnielsen/form5-node-express-mongoose...



Thanks for the compliment! The viewer doesn't quite look and feel right on the iPhone, but glad you didn't think so. =)

I don't know what your stack is, but FYI on Node we use Connect/Express middleware that automatically compiles CoffeeScript files to JS -- and in production, caches the results -- before serving them. No manual building/compiling/packaging needed at any point. You might find something similar for your stack if you haven't already looked:

https://github.com/jashkenas/coffee-script/wiki/Web-framewor...


There was some slight formatting issues but overall it worked well. It's nice to have the additional context/detail with the slides kind of like what you'd get if someone presented it live.

The node.js side project is a RESTful API so all the CS is server code (no front end CS or JS). It all builds automatically and no special config there. I started if off using a stripped down version of the template I linked to above (though removing mongoose and using node-postgres async instead).

The custom build process is for out main app JackDB[1]. It's written in Java and it's a combination of taglibs and a build script. We have a check in there for dev/prod to decide whether to serve precompiled JS files or the original CS files (if its local dev). We did it this way so it fits into our nginx caching setup which marks all static assets as permanently cached (max-age + public). The build process also prefixes the resources with the git revision so each new build forces the client to get the latest and greatest.

[1]: http://www.jackdb.com/


mkdir {js,cs}

coffee -cwo js cs &

echo "alert 'x'" > cs/x.coffee

echo "<script src='js/x.js'></script>" > x.html

open x.html

echo "alert 'x2'" > cs/x.coffee

refresh x.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: