3

I'm using ScriptBundle and set EnableOptimizations to true.

My original script is

$('.carousel').carousel({ interval: 5000, pause: "hover" })

And the result from minification is

$(".carousel").carousel({interval:5e3,pause:"hover"})

Which make the carousel slides super fast! Any idea how to solve this problem? Any escape character should I use to avoid this 5000 turn to 5e3?

Thanks!

4

1 回答 1

6

you can minify bootstrap but a few rules:

Make sure you dont minify a minified version, Taking out the block comments /* */ seems to make things less buggy. and finally seperate everything out like so:

bundles.Add(new ScriptBundle("~/js/jquery").Include(
            "~/assets/js/jquery-{version}.js",
            "~/assets/js/jquery-migrate-{version}.js",
            "~/assets/js/jquery.flexslider.js",
            "~/assets/js/jquery.isotope.js",
            "~/assets/js/jquery.fancybox-{version}.js"
        ));

        bundles.Add(new ScriptBundle("~/js/bootstrap").Include(
            "~/assets/js/bootstrap.js",
            "~/assets/js/jquery.validate.unobtrusive-custom-for-bootstrap.js",
            "~/assets/js/bootstrap-datepicker.js"
        ));

        bundles.Add(new ScriptBundle("~/js/custom").Include(
            "~/assets/js/revolution.custom.js",
            "~/assets/js/custom.js"
            ));

I find that this method seems to calm the beast down and you get good results. i also find that:

<script src="~/assets/js/jquery.validate.min.js"></script>
    <script src="~/assets/js/jquery.validate.unobtrusive.min.js"></script>

These file are best done on there own, and cause major issues with the script bundling.

于 2013-03-31T22:42:03.863 回答