Skip to content
This repository has been archived by the owner. It is now read-only.

Use NUglify instead of AjaxMin #343

Merged
merged 9 commits into from Sep 19, 2019
@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO.Abstractions;
using System.IO;
using Microsoft.Ajax.Utilities;
using NUglify;
using Pretzel.Logic.Extensions;

namespace Pretzel.Logic.Minification
{
@@ -20,13 +21,16 @@ public JsMinifier(IFileSystem fileSystem, IEnumerable<FileInfo> files, string ou

public void Minify()
{
var minifer = new Minifier();
var codeSettings = new CodeSettings();

var content = fileSystem.BundleFiles(files);
var minified = minifer.MinifyJavaScript(content, codeSettings);

fileSystem.File.WriteAllText(outputPath, minified);
var minified = Uglify.Js(content);
if(minified.HasErrors)
{
foreach(var error in minified.Errors)
{
Tracing.Error(error.ToString());
}
}
fileSystem.File.WriteAllText(outputPath, minified.Code);
}
}
}
@@ -27,14 +27,14 @@
<DefineConstants>NETSTANDARD</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AjaxMin" Version="5.14.5506.26202" />
<PackageReference Include="CommonMark.NET" Version="0.15.1" />
<PackageReference Include="dotless.Core" Version="1.6.7" />
<PackageReference Include="DotLiquid" Version="2.0.314" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.12" />
<PackageReference Include="Microsoft.AspNet.Razor" Version="3.2.7" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="2.1.1" />
<PackageReference Include="NDesk.Options" Version="0.2.1" />
<PackageReference Include="NUglify" Version="1.5.13" />
<PackageReference Include="RazorEngine" Version="3.10.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="7.16.0.8981">
<PrivateAssets>all</PrivateAssets>