CoffeeScript and Visualforce (with jQuery!)

To the end user, a simple popup window – to those who have ever pulled their hair out trying to fix someone else’s messy JavaScript: a potential savior.

CoffeeScript is a brilliant little language that compiles into JavaScript – it’s easy to read, write, and implement into Visualforce. I’ve heard so many great things about it that I finally decided to see whether I could use it in my work – and so far it’s been a godsend.

The ideal way (and recommended by CoffeeScript junkies) to leverage CS is to write it locally, compile your .coffee files into .js files from your terminal

save the .js files as static resources, and call the resource with:

But I’m lazy and wanted to simply write CoffeeScript directly in-browser…

Check out this simple dialog window with some animations thrown in:

Some “gotchas” to consider when using CoffeeScript in Visualforce:

  1. Add coffee-script.js as…

View original post 70 more words