B4BCore.BundlerForBower.FormStaticFileWithCacheBuster C# (CSharp) Method

FormStaticFileWithCacheBuster() public method

This returns a file reference with a cachebuster value added.
public FormStaticFileWithCacheBuster ( string absFileUrl, string cacheBusterValue ) : string
absFileUrl string
cacheBusterValue string
return string
        public string FormStaticFileWithCacheBuster(string absFileUrl, string cacheBusterValue)
        {
            if (string.IsNullOrEmpty(config.StaticFileCaching))
                throw new NotImplementedException("The BundlerForBower config file does not support adding a cachebuster."+
                    "It is likely that you have local tags to do that.");

            return
                config.StaticFileCaching.Replace(FileTypeConfigInfo.FileUrlParam, absFileUrl)
                    .Replace(FileTypeConfigInfo.CachebusterParam, cacheBusterValue);
        }

Usage Example

        public void TestBundlerForBowerFormStaticFileWithCacheBusterOk()
        {
            //SETUP
            var b4b = new BundlerForBower(B4BSetupHelper.GetDirRelToTestDirectory("ASPNET Core 1 Config\\"),
                B4BSetupHelper.GetActualFilePathFromVirtualPath(), null);

            //ATTEMPT
            var ex = Assert.Throws<NotImplementedException>(() => b4b.FormStaticFileWithCacheBuster("js/myfile.js", "12345"));

            //VERIFY
            ex.Message.ShouldEqual("The BundlerForBower config file does not support adding a cachebuster." +
                    "It is likely that you have local tags to do that.");
        }
All Usage Examples Of B4BCore.BundlerForBower::FormStaticFileWithCacheBuster