public static IServiceCollection AddStaticFileTransform(this IServiceCollection collection,
                                                         Action <StaticFileTransformBuilder> configure)
 {
     collection.AddSingleton <IStaticFileTransform>(services =>
     {
         var builder = new StaticFileTransformBuilder();
         configure(builder);
         return(builder.Build());
     });
     return(collection);
 }
        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());
        }
        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());
        }
        public static StaticFileTransformBuilder UseDotless(this StaticFileTransformBuilder builder, DotlessOptions options)
        {
            var dotless = new Dotless(options);

            return(builder.Use(dotless.Apply).IfMatches(dotless.Matches).WithCompilerPriority());
        }