The problem we are running into is that we've defined two bundles containing .less files, and we'd like to use one bundle at one time, or the other, based on some arbitrary condition (Imagine that the bundles are nearly identical, but might have minor cosmetic differences).
Suppose we have the following in _layout.cshtml:
@{
var bundleName="~/Content/LessBundle";
if (DateTime.Now.Minute % 2 == 1)
{
bundleName="~/Content/LessBundle_v2";
}
@Styles.Render(bundleName);
}
The unexpected behavior we are seeing in Fiddler is that with the above code, every time a page is refreshed in the browser, A GET request occurs and returns a 200, but the same bundle ID is generated.
To further demonstrate, here is what we are seeing in Fiddler output (oldest to newest requests)
12:01:10: GET /blah/LessBundle?v=8wWviX6PRM-m1BrNdFSTtQQQo_2xtnt6d4aNKYp9p_Y1 HTTP/1.1 (200 return code) 12:01:20: GET /blah/LessBundle?v=8wWviX6PRM-m1BrNdFSTtQQQo_2xtnt6d4aNKYp9p_Y1 HTTP/1.1 (200 return code) ***********should be 304 12:02:05 GET /blah/LessBundle?v=9yWviXPRM-k1BrNdFSTtQQQo_2dddddd4aNKYp9p_B1 HTTP/1.1 (200 return code) OK, new bundle should have been returned 12:02:35 GET /blah/LessBundle?v=9yWviXPRM-k1BrNdFSTtQQQo_2dddddd4aNKYp9p_B1 HTTP/1.1 (200 return code) ***********should be 304
What we are trying to figure out is how to make the change so that if the bundle hasn't changed, we don't regenerate it and send the whole payload on every request
Any help is greatly appreciated!
Thanks, Dominique