private CompilerResult ProcessConfig(string baseFolder, Config config) { ICompiler compiler = CompilerService.GetCompiler(config); var result = compiler.Compile(config); if (result.HasErrors) { return(result); } if (Path.GetExtension(config.OutputFile).Equals(".css", StringComparison.OrdinalIgnoreCase) && AdjustRelativePaths(config)) { result.CompiledContent = CssRelativePath.Adjust(result.CompiledContent, config); } config.Output = result.CompiledContent; FileInfo outputFile = config.GetAbsoluteOutputFile(); bool containsChanges = FileHelpers.HasFileContentChanged(outputFile.FullName, config.Output); OnBeforeProcess(config, baseFolder, containsChanges); if (containsChanges) { string dir = outputFile.DirectoryName; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } File.WriteAllText(outputFile.FullName, config.Output, new UTF8Encoding(true)); } OnAfterProcess(config, baseFolder, containsChanges); //if (!config.Minify.ContainsKey("enabled") || config.Minify["enabled"].ToString().Equals("true", StringComparison.OrdinalIgnoreCase)) //{ FileMinifier.MinifyFile(config); //} if (config.SourceMap) { if (!string.IsNullOrEmpty(result.SourceMap)) { string absolute = config.GetAbsoluteOutputFile().FullName; string mapFile = absolute + ".map"; bool smChanges = FileHelpers.HasFileContentChanged(mapFile, result.SourceMap); OnBeforeWritingSourceMap(absolute, mapFile, smChanges); if (smChanges) { File.WriteAllText(mapFile, result.SourceMap, new UTF8Encoding(true)); } OnAfterWritingSourceMap(absolute, mapFile, smChanges); } } Telemetry.TrackCompile(config); return(result); }