I'm adding a few jQuery script files to my app using the bundleconfig.cs class.
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.mCustomScrollbar.min.js",
"~/Scripts/jquery.mousewheel.min.js",
"~/Scripts/jtable/jquery.jtable.js"));
When I run my app and check the page source, only some of the script files are referenced:
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/jquery-ui-1.10.3.js"></script>
<script src="/Scripts/jtable/jquery.jtable.js"></script>
<script src="/Scripts/jquery-migrate-1.2.1.min.js"></script>
Why would this be happening? I can work around the issue by manually adding the script references directly to _Layout.cshtml, but that is hardly best practice.
The .min part is already handled by MVC - it will automatically include .js files for Debug mode and .min.js files for Release mode.
Just download the unminified version of jquery.mCustomScrollbar.min.js and put it in your scripts directory, then reference it as: jquery.mCustomScrollbar.js
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.mCustomScrollbar.js",
"~/Scripts/jquery.mousewheel.js",
"~/Scripts/jtable/jquery.jtable.js"));
MVC will then load the appropriate script for Debug/Release
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With