public static BundlingConfigurer UseDefaults(this BundlingConfigurer configurer, IHostingEnvironment environment) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } configurer .AddCss() .AddJs() .UseHashVersioning() .UseMemoryCaching(); if (!environment.IsDevelopment()) { configurer.EnableMinification(); } else { configurer.EnableChangeDetection(); } return(configurer); }
public static BundlingConfigurer UseWebMarkupMin(this BundlingConfigurer @this) { @this.Services.Replace(ServiceDescriptor.Singleton <ICssMinifier, CssMinifier>()); @this.Services.Replace(ServiceDescriptor.Singleton <IJsMinifier, JsMinifier>()); return(@this); }
public static BundlingConfigurer UseMemoryCaching(this BundlingConfigurer @this) { @this.Services.AddMemoryCache(); @this.Services.Replace(ServiceDescriptor.Singleton <IBundleCache, MemoryBundleCache>()); return(@this); }
public static BundlingConfigurer UseNUglify(this BundlingConfigurer @this, CssSettings cssSettings = null, CodeSettings jsSettings = null) { @this.Services.Replace(ServiceDescriptor.Singleton <ICssMinifier>(sp => new CssMinifier(cssSettings, sp.GetRequiredService <ILoggerFactory>()))); @this.Services.Replace(ServiceDescriptor.Singleton <IJsMinifier>(sp => new JsMinifier(jsSettings, sp.GetRequiredService <ILoggerFactory>()))); return(@this); }
public static BundlingConfigurer AddJs(this BundlingConfigurer @this, Action <BundleDefaultsOptions, IServiceProvider> configure = null) { @this.Services.AddSingleton <IConfigureOptions <BundleDefaultsOptions> >(sp => new JsBundleConfiguration.Configurer(configure, sp)); @this.Services.AddSingleton <IConfigurationHelper, JsBundleConfiguration.Helper>(); @this.Services.AddSingleton <IExtensionMapper, JsBundleConfiguration.ExtensionMapper>(); return(@this); }
public static BundlingConfigurer EnableCacheHeader(this BundlingConfigurer @this, TimeSpan?maxAge = null) { @this.Services.Configure <BundleGlobalOptions>(o => { o.EnableCacheHeader = true; o.CacheHeaderMaxAge = maxAge; }); return(@this); }
public static BundlingConfigurer AddLess(this BundlingConfigurer @this, Action <BundleDefaultsOptions, IServiceProvider> configureDefaults = null) { @this.Services.AddSingleton <IConfigureOptions <BundleDefaultsOptions> >(sp => new LessBundleConfiguration.Configurer(configureDefaults, sp)); @this.Services.AddSingleton <IConfigurationHelper, LessBundleConfiguration.Helper>(); @this.Services.AddSingleton <IExtensionMapper, LessBundleConfiguration.ExtensionMapper>(); @this.Services.AddSingleton <ILessEngineFactory, LessEngineFactory>(); @this.Services.AddSingleton <ILessCompiler, LessCompiler>(); return(@this); }
public static BundlingConfigurer EnableChangeDetection(this BundlingConfigurer configurer) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.Configure <BundleGlobalOptions>(o => o.EnableChangeDetection = true); return(configurer); }
public static BundlingConfigurer AddEcmaScript(this BundlingConfigurer configurer) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.AddSingleton <IModuleBundlerFactory, DefaultModuleBundlerFactory>(); return(configurer); }
public static BundlingConfigurer UseHashVersioning(this BundlingConfigurer configurer) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.Replace(ServiceDescriptor.Singleton <IBundleVersionProvider, HashBundleVersionProvider>()); return(configurer); }
public static BundlingConfigurer UseMemoryCaching(this BundlingConfigurer configurer) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.AddMemoryCache(); configurer.Services.Replace(ServiceDescriptor.Singleton <IBundleCache, MemoryBundleCache>()); return(configurer); }
public static BundlingConfigurer UseWebMarkupMin(this BundlingConfigurer configurer) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.Replace(ServiceDescriptor.Singleton <ICssMinifier, CssMinifier>()); configurer.Services.Replace(ServiceDescriptor.Singleton <IJsMinifier, JsMinifier>()); return(configurer); }
public static BundlingConfigurer UseNUglify(this BundlingConfigurer configurer, CssSettings cssSettings = null, CodeSettings jsSettings = null) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.Replace(ServiceDescriptor.Singleton <ICssMinifier>(sp => new CssMinifier(cssSettings, sp.GetRequiredService <ILoggerFactory>()))); configurer.Services.Replace(ServiceDescriptor.Singleton <IJsMinifier>(sp => new JsMinifier(jsSettings, sp.GetRequiredService <ILoggerFactory>()))); return(configurer); }
public static BundlingConfigurer AddJs(this BundlingConfigurer configurer, Action <BundleDefaultsOptions, IServiceProvider> configure = null) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.AddSingleton <IConfigureOptions <BundleDefaultsOptions> >(sp => new JsBundleConfiguration.Configurer(configure, sp)); configurer.Services.AddSingleton <IConfigurationHelper, JsBundleConfiguration.Helper>(); configurer.Services.AddSingleton <IExtensionMapper, JsBundleConfiguration.ExtensionMapper>(); return(configurer); }
public static BundlingConfigurer UseFileSystemCaching(this BundlingConfigurer @this, Action <FileSystemBundleCacheOptions> configure = null) { @this.Services.Replace(ServiceDescriptor.Singleton <IBundleCache>(sp => new FileSystemBundleCache( sp.GetRequiredService <IApplicationLifetime>().ApplicationStopping, sp.GetRequiredService <IHostingEnvironment>(), sp.GetRequiredService <ILoggerFactory>(), sp.GetRequiredService <ISystemClock>(), sp.GetRequiredService <IOptions <FileSystemBundleCacheOptions> >(), sp.GetRequiredService <IOptions <BundleGlobalOptions> >()))); if (configure != null) { @this.Services.Configure(configure); } return(@this); }
public static BundlingConfigurer EnableCacheHeader(this BundlingConfigurer configurer, TimeSpan?maxAge = null) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.Configure <BundleGlobalOptions>(o => { o.EnableCacheHeader = true; o.CacheHeaderMaxAge = maxAge; }); return(configurer); }
public static BundlingConfigurer AddSass(this BundlingConfigurer configurer, Action <BundleDefaultsOptions, IServiceProvider> configureDefaults = null) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.AddSingleton <IConfigureOptions <BundleDefaultsOptions> >(sp => new SassBundleConfiguration.Configurer(configureDefaults, sp)); configurer.Services.AddSingleton <IConfigurationHelper, SassBundleConfiguration.Helper>(); configurer.Services.AddSingleton <IExtensionMapper, SassBundleConfiguration.ExtensionMapper>(); configurer.Services.AddSingleton <ISassCompiler, SassCompiler>(); LibSassHost.SassCompiler.FileManager = FileProviderFileManager.Instance; return(configurer); }
public static BundlingConfigurer UseFileSystemCaching(this BundlingConfigurer configurer, Action <FileSystemBundleCacheOptions> configure = null) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Services.Replace(ServiceDescriptor.Singleton <IBundleCache>(sp => new FileSystemBundleCache( sp.GetRequiredService <IHostApplicationLifetime>().ApplicationStopping, sp.GetRequiredService <IWebHostEnvironment>(), sp.GetRequiredService <ILoggerFactory>(), sp.GetRequiredService <ISystemClock>(), sp.GetRequiredService <IOptions <FileSystemBundleCacheOptions> >()))); if (configure != null) { configurer.Services.Configure(configure); } return(configurer); }
public static BundlingConfigurer EnableMinification(this BundlingConfigurer @this) { @this.Services.Configure <BundleGlobalOptions>(o => o.EnableMinification = true); return(@this); }
public static BundlingConfigurer UseTimestampVersioning(this BundlingConfigurer @this) { @this.Services.Replace(ServiceDescriptor.Singleton <IBundleVersionProvider, TimestampBundleVersionProvider>()); return(@this); }