Skip to content

Commit

Permalink
Fix #78 pass AdditionalToolArguments for SVGO
Browse files Browse the repository at this point in the history
  • Loading branch information
markgibbons25 committed Nov 14, 2020
1 parent 6cf19f1 commit 5039b1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ public void ShouldSquishSmallSvg()
args.IsOptimized.Should().BeTrue();
}

[Fact]
public void ShouldSquishSmallSvgWithArgs()
{
Test(@"TestImages\small.svg",
@"..\..\..\..\Dianoga\Dianoga Tools\SVGO\svgop.exe",
"--disable=removeViewBox", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
}

[Fact]
public void ShouldSquishLargeSvg()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Dianoga/Optimizers/Pipelines/DianogaSvg/SvgoOptimizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected void ExecuteProcess(OptimizerArgs args)
using (Process toolProcess = new Process())
{
toolProcess.StartInfo.FileName = ExePath;
toolProcess.StartInfo.Arguments = AdditionalToolArguments;
toolProcess.StartInfo.UseShellExecute = false;
toolProcess.StartInfo.RedirectStandardInput = true;
toolProcess.StartInfo.RedirectStandardOutput = true;
Expand All @@ -30,7 +31,7 @@ protected void ExecuteProcess(OptimizerArgs args)
toolProcess.ErrorDataReceived += (sender, eventArgs) => processOutput.Add(eventArgs.Data);

#if DEBUG
Sitecore.Diagnostics.Log.Info($"\"{ExePath}\"", this);
Sitecore.Diagnostics.Log.Info($"\"{ExePath} {AdditionalToolArguments}\"", this);
#endif

try
Expand Down

0 comments on commit 5039b1b

Please sign in to comment.