asp.netasp.net-mvc-4savebundling-and-minificationasp.net-bundling

ASP.NET bundling - saving generated bundles to disk


I have a lot of bundles. For offline purposes I need to save them to disk. I currently use WebClient.DownloadFile for this, but I have to mantain a separate list of bundles to call DownloadFile on.

Can you please advise me on a better method for this. I think it could work with Transformers or some fictional BundleTable.ListAllBundles() + bundle.GetMinifiedVersion() approach, but I did not find any working examples that would give me the minified version of the script in a string or allow saving to disk.


Solution

  • I ended up iterating over the bundles and adding them to the list of files to download

    foreach (var b in BundleTable.Bundles) {
        pagesToDownload.Add(b.Path);
    }