In the above image we have a CoffeeScript file open, but all the code visible in the editor appears in a chilling bone white. How is that going to amp up coding speed? Simple: it’s not. So next step is to install some syntax highlighters and, while at it, some other useful packages as well.
By default, Sublime Text does not come with support for CoffeeScript.
To install the CoffeeScript syntax highlighter and other packages in Sublime Text with ease, we’re gonna need a package manager. Fortunately, there’s already one available, appropriately named Sublime Package Control. Go ahead and install that now.
With the package manager installed, use it to install the CoffeeScript package if using ST2 or Sublime Better CoffeeScript for ST3. Once installed successfully, CoffeeScript files (those ending in the
.coffee extension) opened after the package is installed will begin appearing with syntax highlighting, like magic.
Syntax highlighting isn’t the only thing the CoffeeScript package does. It also provides a number of convenience code snippets and other facilities to help make working with CoffeeScript easy peasy. But one thing the CoffeeScript add-on for Sublime Text doesn’t do is static code analysis such as linting. However, with Sublime Package Control, adding linting capabilities for CoffeeScript, as well as many other popular languages, is as easy as a few keystrokes and the installation of the SublimeLinter. And presto! Now all you have to worry about for the most part are logic errors and workflow snafus. Unfortunately, the only known method for coping with those that I’m aware of are experience, a curious mind and constant experimentation to find what works best for you.
In summary, this primer has shown how to use a combination of tools to amp up CoffeeScript coding with Sublime Text for a better, faster and easier coding experience. The article covered installation of Sublime Text and Sublime Package Control, as well as two packages to help streamline CoffeeScript coding. Now, when the JS developer wakes up, they’ll be dreaming up the next innovative web application rather than the tools needed to build it.