public static GetCompressedContents ( IEnumerable |
||
bundle | IEnumerable |
|
basePath | string | |
compressor | ICompressor | |
Résultat | string |
private static void BuildCompressedCss(CssPack pack) { var contents = Utils.GetCompressedContents(pack.Files, pack.BasePath, new StyleSheetCompressor()); CompressedCssContentsInternal.Add(pack.Name, contents); if (string.IsNullOrWhiteSpace(pack.CacheBustingString)) { pack.CacheBustingString = Utils.GetSignature(contents); } switch (pack.CacheBustingMethod) { case CacheBustingMethod.VaryByUrlPath: var compressedTemplate = "<link rel=\"stylesheet\" type=\"text/css\" href=\"/bundles/css/{0}/{1}\" />"; CompressedCssTagsInternal.Add(pack.Name, string.Format(compressedTemplate, pack.CacheBustingString, pack.Name)); break; default: compressedTemplate = "<link rel=\"stylesheet\" type=\"text/css\" href=\"/bundles/css/{0}?r={1}\" />"; CompressedCssTagsInternal.Add(pack.Name, string.Format(compressedTemplate, pack.Name, pack.CacheBustingString)); break; } }
private static void BuildCompressedJavaScript(JavaScriptPack pack) { var contents = Utils.GetCompressedContents(pack.Files, pack.BasePath, new JsCompressor()); CompressedJavaScriptContentsInternal.Add(pack.Name, contents); if (string.IsNullOrWhiteSpace(pack.CacheBustingString)) { pack.CacheBustingString = Utils.GetSignature(contents); } switch (pack.CacheBustingMethod) { case CacheBustingMethod.VaryByUrlPath: var compressedTemplate = "<script src=\"/bundles/js/{0}/{1}\"></script>"; CompressedJavaScriptTagsInternal.Add(pack.Name, string.Format(compressedTemplate, pack.CacheBustingString, pack.Name)); break; default: compressedTemplate = "<script src=\"/bundles/js/{0}?r={1}\"></script>"; CompressedJavaScriptTagsInternal.Add(pack.Name, string.Format(compressedTemplate, pack.Name, pack.CacheBustingString)); break; } }