CoffeeScript compilation for Windows
Call the CoffeeScript compiler from .NET, IIS, or the Windows commandline.
Call the CoffeeScript compiler from .NET, IIS, or the Windows commandline.
To install CoffeeSharp in a Visual Studio project, open the Package Manager Console and type:
PM> Install-Package CoffeeSharp
Alternatively, you can use the Package Manager dialog; see the video for an example.
If you can't use NuGet, just download the binaries in a zip file.
The download CoffeeSharp-0.6.zip contains the following:
Coffee.exe
Command line compiler, comparable to the node.js based coffee executable, but missing some options.
CoffeeScriptHttpHandler.dll
HttpHandler for use within an ASP.NET application.<httpHandlers>
<add type="CoffeeSharp.CoffeeScriptHttpHandler, CoffeeScriptHttpHandler"
verb="*" path="*.coffee" />
</httpHandlers>
CoffeeSharp.dll
Class library, exports the CoffeeSharp.CoffeeScriptEngine class.
Jurassic.dll
Required external library for JavaScript evaluation.
Here's an example of how to use the library:
var cse = new CoffeeSharp.CoffeeScriptEngine();
string js = cse.Compile("square = (x) -> x * x");
Here's an example of how to use the commandline tool:
PS> cat .\src\test.coffee
square = (x) -> x * x
console.log 'two squared', square 2
PS> Coffee.exe -o .\bin -c .\src
PS> cat .\bin\test.js
(function() {
var square;
square = function(x) {
return x * x;
};
console.log('two squared', square(2));
}).call(this);
Note: Use the --watch
flag, to keep the compiler running in 'watch-mode'.
This way, it will continue monitoring the source files for any changes, and recompile immediately when they're modified.
The source code of CoffeeSharp is available on github, it is BSD3 licenced.
Updated to CoffeeScript 1.9.3
Updated to CoffeeScript 1.3.1
Updated to CoffeeScript 1.2.0
Updated to CoffeeScript 1.1.2
Updated to CoffeeScript 1.1.0
Initial release, ships with CoffeeScript 1.0.1