Skip to content

Instantly share code, notes, and snippets.

@johnnyreilly
Last active December 19, 2015 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnnyreilly/5934706 to your computer and use it in GitHub Desktop.
Save johnnyreilly/5934706 to your computer and use it in GitHub Desktop.
TypeScript and Cassette
/// <reference path="../../typings/jquery/jquery.d.ts" />
// @reference ~/bundles/core
$(document).ready(function () {
var $body = $("#body");
$body.fadeOut(1000, function () {
$body.html('<div style="width: 150px; margin: 0 auto;">I made it all go away...</div>').fadeIn();
});
});
//@ sourceMappingURL=Index.js.map
/// <reference path="../../typings/jquery/jquery.d.ts" />
// @reference ~/bundles/core
$(document).ready(function () {
var $body = $("#body");
$body.fadeOut(1000, function () {
$body.html('<div style="width: 150px; margin: 0 auto;">I made it all go away...</div>')
.fadeIn();
});
});
using Cassette.BundleProcessing;
using Cassette.Scripts;
namespace CassetteDemo
{
public class InsertIntoPipelineParseJavaScriptNotTypeScriptReferences : IBundlePipelineModifier<ScriptBundle>
{
public IBundlePipeline<ScriptBundle> Modify(IBundlePipeline<ScriptBundle> pipeline)
{
var positionOfJavaScriptReferenceParser = pipeline.IndexOf<ParseJavaScriptReferences>();
pipeline.RemoveAt(positionOfJavaScriptReferenceParser);
pipeline.Insert<ParseJavaScriptNotTypeScriptReferences>(positionOfJavaScriptReferenceParser);
return pipeline;
}
}
}
using System;
using Cassette.Scripts;
namespace CassetteDemo
{
public class ParseJavaScriptNotTypeScriptReferences : ParseJavaScriptReferences
{
protected override bool ShouldAddReference(string referencePath)
{
return !referencePath.EndsWith(".ts", StringComparison.OrdinalIgnoreCase); // Will exclude TypeScript files from being served
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment