Using Smidge in Debug mode to bust cache
o
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
Copy code
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.
Copy code
<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?
o
Which instructions Dean? I'm clearly missing something 😄
d
I think I have used the Quick Start in that site and Pre-defined bundles in another!
o
Thanks. Hmm, ok. I'll take a second / third look and see what's going on.
Thaanks @Dean Leigh - reapplied some of the settings I tried yesterday and it now works. 😄 No idea what the difference is but works now 😄
maybe spoke too soon.
c
I use exactly what you use, but only in the master template. I take a dim view of scattering JS all over pages so it works for me.
o
Cheers Craig, I ended up getting it to work from a Global settings setup.
No idea why it didn't work the first time 😄
107 Views