public string CalculateHtmlIncludes(string bundleName, CssOrJs cssOrJs, bool inDevelopment, Func<string, string> getContentUrl)
{
var settingFilePath = Path.Combine(_jsonDataDir, config.BundlesFileName);
var reader = new ReadBundleFile(settingFilePath);
var fileTypeInfo = config.GetFileTypeData(cssOrJs);
if (inDevelopment)
{
var sb = new StringBuilder();
//we send the individual files as found in the bundle json file
foreach (var relFilePath in _searcher.UnpackBundle(reader.GetBundleDebugFiles(bundleName)))
{
sb.AppendLine(fileTypeInfo.DebugHtmlFormatString
.Replace(FileTypeConfigInfo.FileUrlParam, getContentUrl(relFilePath)));
}
return sb.ToString();
}
//We are in nonDebug, i.e. production mode
var cdnLinks = reader.GetBundleCdnInfo(bundleName);
return cdnLinks.Any()
? FormCdnIncludes(cdnLinks, bundleName, cssOrJs, fileTypeInfo, getContentUrl)
: FormSingleMinifiedFileInclude(bundleName, cssOrJs, fileTypeInfo, getContentUrl);
}