6

The bundling feature is excluded from MVC 6 and the suggested method is to do bundling using gulp tasks.

Using bundling we used to get a random string at the end of the included css/javascript file url(s). This string was very important because once you changed anything in your css/javascript then a new string would be generated which would force browsers to load the new version(s) of the file(s).

So if you had 3 css files they would be bundled into one and they would look like this:

<link href="/Style/css?v=sGJNctjkEuiEEdR68fh0dDt7bwrHIbu_EfQtgon7oYc1" rel="stylesheet">

How can we achieve the same functionality in MVC 6? I don't know whether gulp can help here or not but I am already using gulp to do minification and bundling.

Balázs
  • 2,929
  • 2
  • 19
  • 34
Sul Aga
  • 6,142
  • 5
  • 25
  • 37

1 Answers1

7

For beta6 set asp-file-version="true" to retain cache-busting behavior:

<link rel="stylesheet" href="~/css/site.min.css" asp-file-version="true" />

For beta7, use asp-append-version="true".

Balázs
  • 2,929
  • 2
  • 19
  • 34
Jeff Dunlop
  • 893
  • 1
  • 7
  • 20
  • thank you for your answer. Apparently as of beta 7, you need to use "asp-append-version" as per this link https://github.com/aspnet/Tooling/issues/149 can you please amend your answer so I can mark it as answer. – Sul Aga Aug 23 '15 at 10:04