Пример #1
0
 public NUglifyHtml(NUglifyHtmlOptions options)
 {
     if (options == null)
     {
         options = new NUglifyHtmlOptions();
     }
     _options = options;
 }
Пример #2
0
 public static IServiceCollection AddNUglifyAll(
     this IServiceCollection collection,
     NUglifyCssOptions css   = null,
     NUglifyHtmlOptions html = null,
     NUglifyJsOptions js     = null)
 => collection
 .AddNUglifyCss(css)
 .AddNUglifyHtml(html)
 .AddNUglifyJs(js)
 ;
Пример #3
0
 public static IServiceCollection AddNUglifyHtml(
     this IServiceCollection collection,
     NUglifyHtmlOptions options = null)
 => collection.AddSingleton <IStaticFileTransform>(services
                                                   => new StaticFileTransformBuilder().NUglifyHtml(options).Build());
        public static StaticFileTransformBuilder NUglifyHtml(this StaticFileTransformBuilder builder, NUglifyHtmlOptions options = null)
        {
            var nuglify = new NUglifyHtml(options);

            return(builder
                   .Use((filename, provider) =>
            {
                var content = provider.GetContent(filename);
                return content == null ? null : nuglify.Apply(filename, content);
            })
                   .IfMatches("html?")
                   .WithMinifierPriority());
        }