无法在bundle中添加脚本(asp.net mvc 4)

时间:2021-03-01 08:09:48

I tried to add a few scripts at the same bundle

我试图在同一个包中添加一些脚本

bundles.Add(new ScriptBundle("~/bundles/scripts").Include("~/Scripts/jquery.nivo.slider.pack.js",
            "~/Scripts/jquery.jcarousel.min.js",
            "~/Scripts/jquery.jcarousel-control.min.js",
            "~/Scripts/jquery.jcarousel-autoscroll.min.js"));

but as result I got on my page only one, the first script

但结果我在我的页面上只有一个,第一个脚本

<script src="/Scripts/jquery.nivo.slider.pack.js"></script>

(Of course, I added all scripts in Scripts folder.)
What's wrong? How can I fix it?

(当然,我在Scripts文件夹中添加了所有脚本。)出了什么问题?我该如何解决?

2 个解决方案

#1


1  

Chain the Include calls:

链接包含电话:

bundles.Add(new ScriptBundle("~/bundles/scripts")
    .Include("~/Scripts/jquery.nivo.slider.pack.js")
    .Include("~/Scripts/jquery.jcarousel.min.js")
    .Include("~/Scripts/jquery.jcarousel-control.min.js")
    .Include("~/Scripts/jquery.jcarousel-autoscroll.min.js"))

#2


0  

Try this,

尝试这个,

bundles.Add(new ScriptBundle("~/bundles/Yourscripts").Include(
            "~/Scripts/jquery.nivo.slider.pack.js",
            "~/Scripts/jquery.jcarousel.min.js",
            "~/Scripts/jquery.jcarousel-control.min.js",
            "~/Scripts/jquery.jcarousel-autoscroll.min.js"));

And It works.

它的工作原理。

#1


1  

Chain the Include calls:

链接包含电话:

bundles.Add(new ScriptBundle("~/bundles/scripts")
    .Include("~/Scripts/jquery.nivo.slider.pack.js")
    .Include("~/Scripts/jquery.jcarousel.min.js")
    .Include("~/Scripts/jquery.jcarousel-control.min.js")
    .Include("~/Scripts/jquery.jcarousel-autoscroll.min.js"))

#2


0  

Try this,

尝试这个,

bundles.Add(new ScriptBundle("~/bundles/Yourscripts").Include(
            "~/Scripts/jquery.nivo.slider.pack.js",
            "~/Scripts/jquery.jcarousel.min.js",
            "~/Scripts/jquery.jcarousel-control.min.js",
            "~/Scripts/jquery.jcarousel-autoscroll.min.js"));

And It works.

它的工作原理。