Smidge
Smidge copied to clipboard
Absolute url instead of relative url
See a previous issue regarding absolute url's
Smidge version: 4.1.0
Is this still the way to use absolute url's? Because it doesn't work at our project.
Below our setup. CustomSmidgeDefaultUrlManager.GetUrl doesn't get hitted.
CSHTML
@RenderSection("scripts", required: false)
startup.cs
services.AddSmidge(Configuration.GetSection("smidge"));
services.AddSmidgeInMemory();
services.AddScoped<IUrlManager, CustomSmidgeDefaultUrlManager>();
bundles.CreateJs("scripts", "~/dist/main.js")
.WithEnvironmentOptions(BundleEnvironmentOptions.Create()
.ForDebug(builder => builder
.EnableFileWatcher()
.SetCacheBusterType<AppDomainLifetimeCacheBuster>()
.CacheControlOptions(enableEtag: false, cacheControlMaxAge: 0))
.ForProduction(builder => builder
.EnableCompositeProcessing()
.EnableFileWatcher()
.SetCacheBusterType<AppDomainLifetimeCacheBuster>()
.CacheControlOptions(enableEtag: true, cacheControlMaxAge: 2592000))
.Build()
);
appsettings.json
"smidge": {
"dataFolder": "Smidge",
"version": "2"
},
CustomSmidgeDefaultUrlManager.cs (note: equal to the default of smidge, however GetUrl throws an exception for testing purposes)
namespace Application.Smidge
{
public class CustomSmidgeDefaultUrlManager : IUrlManager
{
public string GetUrl(string bundleName, string fileExtension, bool debug, string cacheBusterValue)
{
throw new Exception("hit");
}
// ...Other default smidge methods
}
}
Are you using this within an Umbraco install? It might be that Umbraco is already replacing this (can't remember)