Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Configure ServiceStack to use Nuglify's Advanced JS/CSS/HTML Minifiers
dotnet add package NUglify
using ServiceStack;
using ServiceStack.Html;
using NUglify;
namespace MyApp
{
public class NUglifyJsMinifier : ICompressor
{
public string Compress(string js) => Uglify.Js(js).Code;
}
public class NUglifyCssMinifier : ICompressor
{
public string Compress(string css) => Uglify.Css(css).Code;
}
public class NUglifyHtmlMinifier : ICompressor
{
public string Compress(string html) => Uglify.Html(html).Code;
}
public class ConfigureNUglify : IConfigureAppHost
{
public void Configure(IAppHost appHost)
{
Minifiers.JavaScript = new NUglifyJsMinifier();
Minifiers.Css = new NUglifyCssMinifier();
Minifiers.Html = new NUglifyHtmlMinifier();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.