A bundle transform for ASP.NET that takes a TypeScript bundle and compiles it to Javascript.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
TypeScriptBundleTransform
libs/Noesis.Javascript.0.7.0
packages
.gitignore
README.md
TypeScriptMvcBundles.sln
license.txt

README.md

TypeScript BundleTransform

A bundle transform for ASP.NET that takes a TypeScript bundle and compiles it to Javascript.

by Wouter Devinck (http://www.wouterdevinck.be)

NuGet

https://nuget.org/packages/TypeScriptBundleTransform

PS> Install-Package TypeScriptBundleTransform

Usage

// Called from Application_Start in Global.asax.cs
public static void RegisterBundles() {
   var bundle = new Bundle("~/default", new TypeScriptTransformer());
   bundle.Include("~/content/test.ts");
   BundleTable.Bundles.Add(bundle);
}

With type checking (throw exception) and whitout minification:

new TypeScriptTransformer();

or

new TypeScriptTransformer(TypeScriptTransformer.ErrorLevel.ThrowException, false)

Without type checking and whitout minification:

new TypeScriptTransformer(TypeScriptTransformer.ErrorLevel.NoTypeChecking, false);

With type checking (log errors in Visual Studio output and as console.error lines in the Javascript output):

new TypeScriptTransformer(TypeScriptTransformer.ErrorLevel.LogError, false);

With minification:

new TypeScriptTransformer(true);

or any of the above with true as the second parameter.

How it works

This uses the TypeScript compiler, which is written in TypeScript and compiled to Javascript and runs it in Google's V8 Javascript Engine on your server. This is an implementation of the IBundleTransform interface, found in System.Web.Optimization.

If you want to take a quick look at the code, this is probably the file you are looking for: https://github.com/wouterdevinck/TypeScript-BundleTransform/blob/master/TypeScriptBundleTransform/TypeScriptTransformer.cs

License

The following licenses apply:

  1. TypeScript-BundleTransform - Apache License 2.0 - https://github.com/wouterdevinck/TypeScript-BundleTransform
  2. TypeScript - Apache License 2.0 - http://typescript.codeplex.com
  3. Noesis Innovation Javascript.NET - New BSD License - http://javascriptdotnet.codeplex.com
  4. Google V8 - New BSD License - http://code.google.com/p/v8/
  5. Douglas Crockford's jsmin.c - License below - http://javascript.crockford.com/jsmin.html
  6. Inspired by: TypeScript-compile - Apache License 2.0 - https://github.com/niutech/typescript-compile/

See license.txt for more info.

More info