public string CheckBundleFileIsNotNewerThanMinifiedFiles()
{
var errors = new List<string>();
var bundleInfo = new FileWithDateUpdated(_mvcAppPath, _bundleFilePath);
//Note: we exclude the cdn bundles as the minified file is not normally created by the build process
var badFiles = (from bundleName in _reader.BundleNames.Where(x => !_reader.GetBundleCdnInfo(x).Any())
let fileExtension = Path.GetExtension(_reader.GetBundleDebugFiles(bundleName, "", s => errors.Add(s)).First())
let fileTypeInfo = _config.GetFileTypeData(fileExtension)
let minfiedFile = new FileWithDateUpdated(_mvcAppPath, Path.Combine(fileTypeInfo.Directory,
bundleName + ".min" + fileExtension))
where !minfiedFile.Exists || minfiedFile.LastWrittenUtc < bundleInfo.LastWrittenUtc
select minfiedFile.FileRelPath).ToList();
if (errors.Any())
return $"Errors in the BowerBundles file: {string.Join("\n", errors)}.";
return badFiles.Any()
? $"The following minified files have not been updated since the change in the bundle file:\n - {string.Join("\n - ", badFiles)}"
: null;
}