Using Ack with CoffeeScript

If you use the wonderful Ack search tool (it's a bit like grep) you may be wondering why it doesn't search your .coffee files.

You need to tell it that .coffee should be treated the same way as .js files, like this:

$ cat >> ~/.ackrc
--type-add
js=.coffee

You can also define a new file type, so that you can search CoffeeScript files without getting matches on any compiled JavaScript:

$ cat >> ~/.ackrc
--type-set
coffee=.coffee

To search for text in your Coffee files, run Ack like this:

$ ack --type coffee 'search phrase'

For more info on configuring Ack, see my post on using Ack with Haml.

I love feedback and questions -- please say hello on Twitter or leave a comment.