A Karma plugin. Compile coffee script on the fly.
Clone or download



js-standard-style npm version npm downloads

Build Status Dependency Status devDependency Status

Preprocessor to compile CoffeeScript on the fly.


The easiest way is to keep karma-coffee-preprocessor as a devDependency. You can simple do it by:

npm install karma-coffee-preprocessor --save-dev


Following code shows the default configuration

// karma.conf.js
module.exports = function(config) {
    preprocessors: {
      '**/*.coffee': ['coffee']

    coffeePreprocessor: {
      // options passed to the coffee compiler
      options: {
        bare: true,
        sourceMap: false
      // transforming the filenames
      transformPath: function(path) {
        return path.replace(/\.coffee$/, '.js')

    // make sure to include the .coffee files not the compiled .js files
    files: [

If you set the sourceMap coffee compiler option to true then the generated source map will be inlined as a data-uri.

Note that paths like "**/.coffee" inside your "preprocessor" list will not match files where you are traversing up a directory (like "../app/.coffee" inside your "files" list) or where your basePath goes up a directory. If you need to match these, use something like preprocessors: { '../**/*.coffee': ['coffee'] }.

For more information on Karma see the homepage.