1

I'm trying to keep CSS from caching. To do so I'm trying to time stamp my CSS. In including CSS the basic way would look like this:

<link rel="stylesheet" type="text/css" href="style.css?Thursday 24th of April 2008 04:45:21 PM" />

But on my project I am using BundleConfig to handle all CSS and JavaScript includes:

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new StyleBundle("~/Content/myStyles").Include(
            "~/Content/Styles/style1.css",
            "~/Content/Styles/style2.css",
            "~/Content/Styles/style3.css"));
    }
}

I read about Bundle.CacheLookup and Bundle.UpdateCache, but I am confused. I don't think they are what I'm looking for.

What do I do with my BundleCollection to get it to include the question mark and a date time value when it produces the basic CSS call for the browser?

BlueCardinal
  • 87
  • 2
  • 9
  • bundles should automatically add a timestamp. are you saying you want to customize the format of that timestamp? –  Aug 25 '17 at 20:20
  • 2
    Maybe this could help: https://stackoverflow.com/questions/15005481/mvc4-stylebundle-can-you-add-a-cache-busting-query-string-in-debug-mode – Xiaoy312 Aug 25 '17 at 20:26
  • @Xiaoy312 That is perfect! Thank you! – BlueCardinal Aug 29 '17 at 15:26

0 Answers0