0

Possible Duplicate:
mvc4 bundler not including .min files

I am trying to include a JS file into my bundles.

I register new bundle in BundleConfig.cs file like so:

bundles.Add(new ScriptBundle("~/bundles/toastr").Include(
                    "~/Scripts/toastr.min.js"));

And then I call it in my master page like so:

@Scripts.Render("~/bundles/toastr")

And it is not being rendered in the HTML page.

Am I missing something?

Community
  • 1
  • 1
Bartosz
  • 4,542
  • 11
  • 43
  • 69

1 Answers1

3

You seem to be minifying an already minified javascript which hardly makes sense. The bundling and minification in ASP.NET MVC detects this inconsistency because of the name of your javascript file (containing .min.js) and ignores it.

So you could get the non-minified version of the plugin you are using and then register it as a bundle:

bundles.Add(
    new ScriptBundle("~/bundles/toastr").Include("~/Scripts/toastr.js")
);
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928