Created
March 22, 2013 21:02
-
-
Save danabenson/5224712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ 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