Skip to content

Instantly share code, notes, and snippets.

@danabenson
Created March 22, 2013 21:02
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 danabenson/5224712 to your computer and use it in GitHub Desktop.
Save danabenson/5224712 to your computer and use it in GitHub Desktop.
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.IO" #>
<#@ output extension=".ts" #>
<#
string dirPath = this.Host.ResolvePath("");
string[] tsFiles = Directory.GetFiles(dirPath, "*.ts", SearchOption.AllDirectories);
//have to do our own dependancy ordering :(
var exclude = tsFiles.Where(x=>x.Contains("_references.ts"));
var pre = tsFiles.Where(x=>x.EndsWith("Base.ts"));
var post = tsFiles.Where(x=>x.EndsWith("Main.ts"));
var mid = tsFiles.Except(pre).Except(post).Except(exclude);
var all = pre.Union(mid).Union(post);
foreach (var tsFile in all)
{
var relativePath = tsFile.Replace(dirPath, string.Empty);
relativePath = relativePath.TrimStart(new char[] {'\\'});
relativePath = relativePath.Replace("\\","/");
#>
/// <reference path="<#= relativePath #>" />
<# } #>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment