private async static Threading.Task WriteMinFile(string bundleSourcePath, string extension, bool bundleChanged) { string minPath = Path.ChangeExtension(bundleSourcePath, ".min" + Path.GetExtension(bundleSourcePath)); // If the bundle didn't change, don't re-minify, unless the user just enabled minification. if (!bundleChanged && File.Exists(minPath)) { return; } var fers = WebEditor.ExportProvider.GetExport <IFileExtensionRegistryService>().Value; var contentType = fers.GetContentTypeForExtension(extension); var settings = WESettings.Instance.ForContentType <IMinifierSettings>(contentType); var minifier = Mef.GetImport <IFileMinifier>(contentType); bool changed = await minifier.MinifyFile(bundleSourcePath, minPath); if (settings.GzipMinifiedFiles && (changed || !File.Exists(minPath + ".gzip"))) { FileHelpers.GzipFile(minPath); } }