Cache busting css files

Hi,

I have series of css file that are being loaded in the app, but i want to implement versioning to prevent caching issue. Is there a way to achieve that in dotvvm?

//register custom resources and adjust paths to the built -in resources
config.Resources.Register(“bootstrap-css”, new StylesheetResource
{
Location = new UrlResourceLocation(“~/Content/bootstrap.min.css”)
});
config.Resources.Register(“bootstrap”, new ScriptResource
{
Location = new UrlResourceLocation(“~/Scripts/bootstrap.min.js”),
Dependencies = new { “bootstrap-css”, “jquery” }
});
config.Resources.Register(“jquery”, new ScriptResource
{
Location = new UrlResourceLocation(“~/administrator/js/jquery-1.7.2.min.js”)
});
config.Resources.Register(“Styles”, new StylesheetResource()
{
Location = new UrlResourceLocation(“~/Styles/styles.css”)
});

        config.Resources.Register("LoadingAnimationPostBackHandler", new ScriptResource()
        {
            Location = new UrlResourceLocation("~/Scripts/DotVVM/LoadingAnimationPostBackHandler.js"),
            Dependencies = new[] { "dotvvm" }
        });

Yes, DotVVM does that automatically if you use FileResourceLocation (or other location derived from LocalResourceLocation). Note that the file location expects a filesystem path (i.e. without ~, relative to your application folder, not wwwroot). The resource is then served on dotvvmResource/{checksum and name} URL.

If you can’t or don’t want to use this, you can load the file, hash it and put the hash into the URL manually: new UrlResourceLocation($“~/Styles/styles.css?{hash}”). Alternatively, just put a Guid.NewGuid() into the URL, which will invalidate the cache every time you restart the application