Skip to content

Commit 9715f59

Browse files
committed
add fallback try/catch around js Nuglify can't handle
1 parent 0db7196 commit 9715f59

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Configure.Nuglify.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using ServiceStack;
23
using ServiceStack.Html;
34
using NUglify;
@@ -6,7 +7,18 @@ namespace SharpScript
67
{
78
public class NUglifyJsMinifier : ICompressor
89
{
9-
public string Compress(string js) => Uglify.Js(js).Code;
10+
public string Compress(string js)
11+
{
12+
try
13+
{
14+
return Uglify.Js(js).Code;
15+
}
16+
catch (Exception e)
17+
{
18+
Console.WriteLine(e);
19+
return js;
20+
}
21+
}
1022
}
1123
public class NUglifyCssMinifier : ICompressor
1224
{

src/SharpScript.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.*" />
1111
<PackageReference Include="System.IO.FileSystem.DriveInfo" Version="4.3.*" />
12-
<PackageReference Include="NUglify" Version="1.5.13" />
12+
<PackageReference Include="NUglify" Version="1.20.0" />
1313

1414
<PackageReference Include="ServiceStack" Version="6.*" />
1515
<PackageReference Include="ServiceStack.Interfaces" Version="6.*" />

0 commit comments

Comments
 (0)