コード例 #1
0
 public NUglifyJs(NUglifyJsOptions options)
 {
     if (options == null)
     {
         options = new NUglifyJsOptions();
     }
     _codeSettings = options.CodeSettings;
 }
コード例 #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 AddNUglifyJs(
     this IServiceCollection collection,
     NUglifyJsOptions options = null)
 => collection.AddSingleton <IStaticFileTransform>(services
                                                   => new StaticFileTransformBuilder().NUglifyJs(options).Build());
        public static StaticFileTransformBuilder NUglifyJs(this StaticFileTransformBuilder builder, NUglifyJsOptions options = null)
        {
            var nuglify = new NUglifyJs(options);

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