public NUglifyCss(NUglifyCssOptions options)
 {
     if (options == null)
     {
         options = new NUglifyCssOptions();
     }
     _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 AddNUglifyCss(this IServiceCollection collection, NUglifyCssOptions options = null)
 => collection.AddSingleton <IStaticFileTransform>(services
                                                   => new StaticFileTransformBuilder().NUglifyCss(options).Build());
        public static StaticFileTransformBuilder NUglifyCss(this StaticFileTransformBuilder builder, NUglifyCssOptions options = null)
        {
            var nuglify = new NUglifyCss(options);

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