Skip to content


Subversion checkout URL

You can clone with
Download ZIP
CoffeeScript Compiler Implementation in .NET
C# CoffeeScript JavaScript Other



.NET compiler for .coffee files using coffee-script.js & Jurassic

Embedding of local or external .js or .coffee files



1. install as a Nuget package:

Download and install Nuget if you do not allready have it.

  • Installs as a single JurassicCoffee.dll
  • Adds a *.coffee HttpHandler to you web.config if you have one
>> Install-Package jurassic-coffee

make sure to add the following if you are installing into a MVC application : Anujb


2. download and build it from source

Always nice to have the latest version

3. Download a pre-built binary

note that it may be be an older version than that from source


Configurable post & pre-compilation actions

var compiler = new CoffeeCompiler();


# require

includes desired coffee file into the compilation

sayhello = (name)-> alert name

#= require
sayhello 'charles'

# require `file.js`

embeds desired javascript file.

Important: The js file path must be enclosed in the special single quote.

#= require `./js/common.min.js`

#= require `./jquery-1.6.1.min.js`
$(document).ready -> 
  message = "JurassicCoffee!"
  h1 = $(document.createElement 'h1')
  h1.text message
  $('body').prepend h1    

including external files via http(s)

files can be loaded via http(s)

additional require statements in files loaded in this manner will not be evaluated

#= require ``  


Visual Studio Build Events

You can add a coffeescript compilation step to any Visual Studio project, including the free Visual Studio Express edition, via simple Build Events.

Before you start, make sure you have the following information to hand:

  • The path to the JurassicCoffee.Console.exe (this will probably be inside you solution or in a nuget folder)
  • The path(s) to you coffee files. JurassicCoffee allows you to specify either directories or individual files.

Compile a Single File

The Build Event below first changes directory (CD) to the location of the JurassicCoffee.Console.exe. It then calls the exe specifying the full path of the coffee file to be compiled. The compiled output will be an uncompressed javascript file placed in the same folder and named hello.js.

CD "$(SolutionDir)Tools\JurassicCoffee"
CALL JurassicCoffee.Console.exe "$(ProjectDir)coffee\"

Compile a Directory of Files

This example calls the exe specifying the full path of a Directory containing multiple coffee files. Each file will be compiled and compressed with the output placed in the same folder and named *.min.js.

CD "$(SolutionDir)Tools\JurassicCoffee"
CALL JurassicCoffee.Console.exe "$(ProjectDir)coffee -c"

Specify an Output Directory for all Compiled Files

This example specifies a Directory of coffee files and an Output Directory. Each compiled and compressed file will be placed into the Output Directory and named *.min.js.

CD "$(SolutionDir)Tools\JurassicCoffee"
CALL JurassicCoffee.Console.exe "$(ProjectDir)coffee" -c -o "$(ProjectDir)js"

command line tool

JurassicCoffee.exe //compiles into script.js
JurassicCoffee.exe -o out.js //compiles into out.js
JurassicCoffee.exe -c //YUI Compression enabled
JurassicCoffee.exe -e coffee-script.nighlty.version.js //compile using custom version of coffee-script

Http Handler

  • Compiles .coffee files into .js files
  • Keeps track of .coffee and compiled .js files and only re-compiles when files are added, deleted or changed
  • Keeps track of included files from "#= require" sprockets and re-compiles on changes


configuration section

    <section name="" type="JurassicCoffee.Web.Configuration.ConfigurationHandler, JurassicCoffee.Web"/>

    <!--enable/disable YUI compression-->
    <!--compiled .js output directory-->
    <!--disabled compression and adds debug information to compiled files-->

http handler section

    <add type="JurassicCoffee.Web.JurassicCoffeeHttpHandler,JurassicCoffee.Web" validate="false" path="*.coffee" verb="*" />

make sure to add the following if you have a MVC application : Anujb



    var compiler = new JurassicCoffee.Core.Compiler();

    //Compile into test.js

    //Compiles coffeescript string into a javascript string
    var javascriptString = compiler.CompileString("helloworld -> 'hello world'");

    //Compiles inputstream into outputstream
Something went wrong with that request. Please try again.