diff options
author | unknown <andarno@.redmond.corp.microsoft.com> | 2009-09-27 22:46:25 -0700 |
---|---|---|
committer | unknown <andarno@.redmond.corp.microsoft.com> | 2009-09-27 22:46:25 -0700 |
commit | d059d5cd817805ce2b6c66c9044a3cb4a1967c6a (patch) | |
tree | e91c2cb552b6c3c6ff8727858a7ee088ea600917 /src/DotNetOpenAuth.BuildTasks/JsPack.cs | |
parent | 927dc2db54daaa41383a1a9f492ff031caac18ae (diff) | |
download | DotNetOpenAuth-d059d5cd817805ce2b6c66c9044a3cb4a1967c6a.zip DotNetOpenAuth-d059d5cd817805ce2b6c66c9044a3cb4a1967c6a.tar.gz DotNetOpenAuth-d059d5cd817805ce2b6c66c9044a3cb4a1967c6a.tar.bz2 |
Added method for preserving copyright notices in minified .js files.
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks/JsPack.cs')
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/JsPack.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/JsPack.cs b/src/DotNetOpenAuth.BuildTasks/JsPack.cs index a6a5b27..fa8c7f0 100644 --- a/src/DotNetOpenAuth.BuildTasks/JsPack.cs +++ b/src/DotNetOpenAuth.BuildTasks/JsPack.cs @@ -55,6 +55,14 @@ namespace DotNetOpenAuth.BuildTasks { Directory.CreateDirectory(Path.GetDirectoryName(this.Outputs[i].ItemSpec)); } + // Minification removes all comments, including copyright notices + // that must remain. So if there's metadata on this item with + // a copyright notice on it, stick it on the front of the file. + string copyright = this.Inputs[i].GetMetadata("Copyright"); + if (!string.IsNullOrEmpty(copyright)) { + output = "/*" + copyright + "*/" + output; + } + File.WriteAllText(this.Outputs[i].ItemSpec, output, Encoding.UTF8); } else { Log.LogMessage(MessageImportance.Low, TaskStrings.SkipPackingJsFile, this.Inputs[i].ItemSpec); |