Smidge icon indicating copy to clipboard operation
Smidge copied to clipboard

How to automatically compile bundle in debug mode when any changes occur

Open nhaberl opened this issue 1 year ago • 1 comments
trafficstars

Hi,

we are using Umbraco 10 including smidge for client side js and less/css bundling. What we run into trouble is when changing any js file which is in a bundle we cannot access the "fresh" code in the browser ... it stys like the bundle was defined on startup.

So my question is how can we achive at least for development that any changes occur triggers a rebuild and we can access the new bundle?

Our code we use now on startup

`services.AddSmidge(_config.GetSection("smidge")); services.Configure<SmidgeOptions>(options => { string cachebuster = _config.GetSection("Umbraco:CMS:RuntimeMinification").GetValue("CacheBuster") ?? "AppDomain"; Type cacheBusterType = Enum.Parse<RuntimeMinificationCacheBuster>(cachebuster) switch { RuntimeMinificationCacheBuster.AppDomain => typeof(AppDomainLifetimeCacheBuster), RuntimeMinificationCacheBuster.Version => typeof(ConfigCacheBuster), RuntimeMinificationCacheBuster.Timestamp => typeof(TimestampCacheBuster), _ => throw new NotImplementedException(), };

options.DefaultBundleOptions.DebugOptions.FileWatchOptions.Enabled = true;
options.DefaultBundleOptions.DebugOptions.SetCacheBusterType(cacheBusterType);
options.DefaultBundleOptions.ProductionOptions.SetCacheBusterType(cacheBusterType);
options.DefaultBundleOptions.ProductionOptions.ProcessAsCompositeFile = true;

});`

Any suggestions welcome Thanks

nhaberl avatar Jan 23 '24 09:01 nhaberl

Are you referring to back office or front-end assets?

Shazwazza avatar Feb 05 '24 23:02 Shazwazza