Cassette provides built-in support for the excellent CoffeeScript language. Add .coffee files to your project and Cassette will compile them into JavaScript and bundle them with the rest of your scripts.

Important: All .coffee files must have their Build Action set to Content so they will get deployed with the web application.

  1. Select the files in the Visual Studio Solution Explorer
  2. Right-click > Properties
  3. In the Properties window, set Build Action to Content


Reference the other assets a coffee file depends on using following special comment syntax:

# @reference ../jquery.js


@reference ../jquery.js
@reference another.js

Reference paths are relative to the current coffee file.

Improving Performance

Cassette's default CoffeeScript compiler can be slow for large files. To improve performance try using the Internet Explorer based compiler. In CassetteConfiguration change the compiler:

public class CassetteConfiguration : ICassetteConfiguration
    public void Configure(BundleCollection bundles, CassetteSettings settings)
            b => b.Processor = new ScriptPipeline
                CoffeeScriptCompiler = new IECoffeeScriptCompiler()

Please note: The IECoffeeScriptCompiler requires Full Trust because it uses COM Interop to access Internet Explorer's JavaScript engine. You should also have Internet Explorer 9 or better installed to see a significant performance boost.