What makes Squishit rebuild bundles

Can someone tell me what reasons / Squishit triggers rebuild the package in production mode?

For example, if I create the following package, the file "Site.Master_ {GUID] .css" is created as expected.

<%= Bundle.Css() .Add("~/css/reset.css") .Add("~/css/typography.css") .Add("~/css/styles.css") .Add("~/MasterPages/Site.Master.css") .Render("~/Cache/Site.Master_#.css") %> 

But if I delete the file with the file package, it will not be recreated. I discovered, through trial and error, that if I changed the web.config file to

 <compilation debug="true" targetFramework="4.0" /> 

and then back to false

 <compilation debug="false" targetFramework="4.0" /> 

the next time the page is requested, the package is rebuilt, but I would like to know:

a) how Squishit decides whether a particular site should be built or rebuilt

b) if there is a recognized way to reset Squishit to restore all packages - after clearing the cache or updating the site, for example.

Thanks.

+4
source share
1 answer

SquishIt does not really decide if a particular package should be built or rebuilt - if there is a package in the SquishIt cache, it is assumed that the file still exists. This is by design, as it will be very expensive to check the file system every time the package cache is available.

Since bundles are cached in HttpRuntime.Cache, you can force recovery by clearing the corresponding items from the cache. The prefix "squishit_" is used for all added items, and then "css" or "js" can be used to determine the type of asset. Everything that clears the cache should lead to rebuilding packages, including the reset site (which disables the modification of your web.config). If you need a backdoor path to manage this at runtime, perhaps something like this can be changed to suit your needs.

Another thing that will cause the package to be reinstalled is changing one of the files included in its contents. This is controlled by CacheDependency when packets are first added to the cache.

+7
source

All Articles