Using Smidge in Debug mode to bust cache
o

Owain

about 1 year ago
Hey, has anyone managed to get smidge to bust the cache, specifically for javascript files, but setting the Configuration options as should in the github exmaple? https://github.com/Shazwazza/Smidge/wiki/installation
services.AddSmidge(_config)
    .Configure<SmidgeOptions>(options =>
    {
        //specify callback for filtering the pipeline for a given web file:
        options.PipelineFactory.OnGetDefault = GetDefaultPipelineFactory;
        //change some of the bundle options for rendering in Debug mode:
        options.DefaultBundleOptions.DebugOptions.SetCacheBusterType<AppDomainLifetimeCacheBuster>();
        options.DefaultBundleOptions.DebugOptions.FileWatchOptions.Enabled = true;
        //change some of the bundle options for rendering in Production mode:
        options.DefaultBundleOptions.ProductionOptions.SetCacheBusterType<AppDomainLifetimeCacheBuster>();
    });
From my understanding, which isn't much, I would have thought that if I am running the project locally, via Visual Studio / Kestrel, then my cache should be cleared every time I spin up the site and any JS changes I have made would be picked up. This doesn't seem to be the case. The only thing I've found that works is if I set debug on my import e.g.
<environment names="Development">
    @await SmidgeHelper.JsHereAsync(debug: true)
</environment>
<environment names="Staging,Production">
    @await SmidgeHelper.JsHereAsync(debug: false)
</environment>
This works but I would prefer not to have to set this on every instance that I use the SmidgeHelper. Anyone had similar issues?