public async Task Test4() { var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes( @" { ""compilerOptions"": { ""style"": ""expanded"", ""sourceMap"": true, ""sourceDir"": ""Content/scss"", ""outDir"": ""wwwroot/css"" }, ""files"": [ ""test.scss"" ] } ")); memoryStream.Seek(0, SeekOrigin.Begin); var loader = new SassConfigLoader(); var config = await loader.LoadAsync(memoryStream); Assert.NotNull(config.CompilerOptions); Assert.Equal(CssStyle.Expanded, config.CompilerOptions.Style); Assert.True(config.CompilerOptions.SourceMap); Assert.Equal("Content/scss", config.CompilerOptions.SourceDir); Assert.Equal("wwwroot/css", config.CompilerOptions.OutDir); Assert.Equal(new [] { "test.scss" }, config.Files); }
public override bool Execute() { var task = Task.Run(async() => { try { SassConfig config = null; var configFilePath = ConfigPath ?? SASS_CONFIG_FILENAME; if (configFilePath != null) { configFilePath = Path.GetFullPath(configFilePath); if (File.Exists(configFilePath)) { var sassConfigLoader = new SassConfigLoader(); using (Stream stream = File.OpenRead(configFilePath)) { config = await sassConfigLoader.LoadAsync(stream); } } else { Log.LogError($"Config file \"{configFilePath}\" does not exist."); return(false); } } else { // Default config config = new SassConfig(); } SassCommandArgumentBuilder commandArgumentBuilder = new SassCommandArgumentBuilder(config, Environment.CurrentDirectory); var commandArguments = commandArgumentBuilder.BuildArgs(); Log.LogMessage(commandArguments); ExecuteSassCommand(commandArguments); Log.LogMessage($"Sass files were successfully compiled."); return(true); } catch (Exception e) { Log.LogErrorFromException(e); return(false); } }); return(task.GetAwaiter().GetResult()); }
public async Task Test1() { var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes( @" { } ")); memoryStream.Seek(0, SeekOrigin.Begin); var loader = new SassConfigLoader(); var config = await loader.LoadAsync(memoryStream); }
public async Task Test1() { var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes( @" { } ")); memoryStream.Seek(0, SeekOrigin.Begin); var loader = new SassConfigLoader(); var config = await loader.LoadAsync(memoryStream); SassCommandArgumentBuilder commandArgumentBuilder = new SassCommandArgumentBuilder(config, Environment.CurrentDirectory); var commandArguments = commandArgumentBuilder.BuildArgs(); }
public async Task Test2() { var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes( @" { ""compilerOptions"": { ""style"": ""compressed"" } } ")); memoryStream.Seek(0, SeekOrigin.Begin); var loader = new SassConfigLoader(); var config = await loader.LoadAsync(memoryStream); Assert.NotNull(config.CompilerOptions); Assert.Equal(CssStyle.Compressed, config.CompilerOptions.Style); }
public async Task Test3() { var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes( @" { ""files"": [ ""file1"", ""file2"", ""file3"" ] } ")); memoryStream.Seek(0, SeekOrigin.Begin); var loader = new SassConfigLoader(); var config = await loader.LoadAsync(memoryStream); Assert.True(config.Files.SequenceEqual(new [] { "file1", "file2", "file3" })); }
public async Task Test2() { var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes( @" { ""compilerOptions"": { ""style"": ""expanded"", ""sourceMap"": true, ""outDir"": ""wwwroot/css"" }, ""files"": [ ""test.scss"" ] } ")); memoryStream.Seek(0, SeekOrigin.Begin); var loader = new SassConfigLoader(); var config = await loader.LoadAsync(memoryStream); SassCommandArgumentBuilder commandArgumentBuilder = new SassCommandArgumentBuilder(config, Environment.CurrentDirectory); var commandArguments = commandArgumentBuilder.BuildArgs(); }