I'm working on a asp.net web-form website in which I use ../
for routing files like js files, styles, etc. When I decided to apply ScriptBundle
and replace ~/
instead ../
the website didn't work at.
js file completely are loaded on browser but they didn't work.
This is my code before ScriptBundle
that work perfectly:
<!-- Page Scripts Starts -->
<script src="../Script/jquery.min.js"></script>
<script src="../Script/jquery.colorpanel.js"></script>
<script src="../Script/bootstrap.min.js"></script>
<script src="../Script/jquery.flexslider.js"></script>
<script src="../Script/bootstrap-datepicker.js"></script>
<script src="../Script/owl.carousel.min.js"></script>
<script src="../Script/custom-navigation.js"></script>
<script src="../Script/custom-flex.js"></script>
<script src="../Script/custom-owl.js"></script>
<script src="../Script/custom-date-picker.js"></script>
<!-- Page Scripts Ends -->
and this is after ScriptBundle
:
<!-- Page Scripts Starts -->
<%: Scripts.Render("~/Script/js") %>
<!-- Page Scripts Ends -->
Cs file:
bundles.Add(new ScriptBundle("~/Script/js").Include(
"~/Script/bootstrap-datepicker.js",
"~/Script/bootstrap.min.js",
"~/Script/custom-date-picker.js",
"~/Script/custom-flex.js",
"~/Script/custom-navigation.js",
"~/Script/custom-owl.js",
"~/Script/jquery.colorpanel.js",
"~/Script/jquery.flexslider.js",
"~/Script/jquery.min.js",
"~/Script/owl.carousel.min.js"));
That is beacuse the order of the script files (in .cs) is wrong.
jquery.min.js
should most likely be first. Change the order so that it is the same as per your working example. Since atleast alljquery.*.js
files usesjquery.min.js
they must be loaded afterjquery.min.js
.