diff --git a/src/WebCompiler/Config/ConfigFileProcessor.cs b/src/WebCompiler/Config/ConfigFileProcessor.cs index f79018c6..5fa719a6 100644 --- a/src/WebCompiler/Config/ConfigFileProcessor.cs +++ b/src/WebCompiler/Config/ConfigFileProcessor.cs @@ -22,7 +22,7 @@ public class ConfigFileProcessor /// Optional configuration items in the config file /// Forces compilation of all config items. /// A list of compiler results. - public IEnumerable Process(string configFile, IEnumerable configs = null, bool force = false) + public IEnumerable Process(string configFile, Config[] configs = null, bool force = false) { if (_processing.Contains(configFile)) return Enumerable.Empty(); @@ -36,8 +36,8 @@ public IEnumerable Process(string configFile, IEnumerable 0) + OnConfigProcessed(configs.First(), 0, configs.Length); int i = 0; foreach (Config config in configs) @@ -56,7 +56,7 @@ public IEnumerable Process(string configFile, IEnumerable /// A relative or absolute file path to the configuration file. /// A list of Config objects. - public static IEnumerable GetConfigs(string fileName) + public static Config[] GetConfigs(string fileName) { FileInfo file = new FileInfo(fileName); if (!file.Exists) - return Enumerable.Empty(); + return new Config[0]; string content = File.ReadAllText(fileName); - var configs = JsonConvert.DeserializeObject>(content); - string folder = Path.GetDirectoryName(file.FullName); + Config[] configs = JsonConvert.DeserializeObject(content); foreach (Config config in configs) { diff --git a/src/WebCompiler/Program.cs b/src/WebCompiler/Program.cs index 068d49db..e06cafe7 100644 --- a/src/WebCompiler/Program.cs +++ b/src/WebCompiler/Program.cs @@ -50,7 +50,7 @@ private static void EventHookups(ConfigFileProcessor processor, string configPat FileMinifier.AfterWritingGzipFile += (s, e) => { Console.WriteLine($" \x1B[32mGZipped"); }; } - private static IEnumerable GetConfigs(string configPath, string file) + private static Config[] GetConfigs(string configPath, string file) { var configs = ConfigHandler.GetConfigs(configPath); @@ -60,9 +60,9 @@ private static IEnumerable GetConfigs(string configPath, string file) if (file != null) { if (file.StartsWith("*")) - configs = configs.Where(c => Path.GetExtension(c.InputFile).Equals(file.Substring(1), StringComparison.OrdinalIgnoreCase)); + configs = configs.Where(c => Path.GetExtension(c.InputFile).Equals(file.Substring(1), StringComparison.OrdinalIgnoreCase)).ToArray(); else - configs = configs.Where(c => c.InputFile.Equals(file, StringComparison.OrdinalIgnoreCase)); + configs = configs.Where(c => c.InputFile.Equals(file, StringComparison.OrdinalIgnoreCase)).ToArray(); } return configs; diff --git a/src/WebCompilerTest/Config/ConfigHandlerTest.cs b/src/WebCompilerTest/Config/ConfigHandlerTest.cs index eb809266..7109c69e 100644 --- a/src/WebCompilerTest/Config/ConfigHandlerTest.cs +++ b/src/WebCompilerTest/Config/ConfigHandlerTest.cs @@ -45,11 +45,9 @@ public void AddConfig() [TestMethod, TestCategory("Config")] public void NonExistingConfigFileShouldReturnEmptyList() { - var expectedResult = Enumerable.Empty(); - var result = ConfigHandler.GetConfigs("../NonExistingFile.config"); - Assert.AreEqual(expectedResult, result); + Assert.AreEqual(0, result.Length); } } } diff --git a/src/WebCompilerTest/Minify/artifacts/css/minify.less b/src/WebCompilerTest/Minify/artifacts/css/minify.less index 46800d16..64d2da4f 100644 --- a/src/WebCompilerTest/Minify/artifacts/css/minify.less +++ b/src/WebCompilerTest/Minify/artifacts/css/minify.less @@ -1,2 +1,3 @@ body { + background: black } diff --git a/src/WebCompilerVsix/CompilerService.cs b/src/WebCompilerVsix/CompilerService.cs index 4246b9c2..d876a27c 100644 --- a/src/WebCompilerVsix/CompilerService.cs +++ b/src/WebCompilerVsix/CompilerService.cs @@ -51,7 +51,7 @@ private static void ConfigProcessed(object sender, ConfigProcessedEventArgs e) _dte.StatusBar.Progress(true, "Compiling...", e.AmountProcessed, e.Total); } - public static void Process(string configFile, IEnumerable configs = null, bool force = false) + public static void Process(string configFile, Config[] configs = null, bool force = false) { ThreadPool.QueueUserWorkItem((o) => {