Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Do I need to use Bundles to include scripts?
Message
De
27/09/2012 16:36:51
 
 
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01553787
Message ID:
01553791
Vues:
65
This message has been marked as the solution to the initial question of the thread.
If it's your own file, you don't need to include it in the bundle. If it's on a CDN, you should include it in the bundle. This has a couple of advantages:

- In development, the local file will be used. This allows you to debug into the js file if needed
- At runtime, the minified version of the file is pulled from the CDN


>Hi everybody,
>
>In my _layout.cshtml I have the following code
>
><!DOCTYPE html>
><html lang="en">
>    <head>
>        <meta charset="utf-8" />
>        <title>@ViewBag.Title</title>
>        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
>        <meta name="viewport" content="width=device-width" />
>        @Styles.Render("~/Content/css")
>        @Styles.Render("~/Content/themes/base/css")
>        @Scripts.Render("~/bundles/modernizr")
>
>    </head>
>    <body>
>        <header>
>            <div class="content-wrapper">
>                @*<div class="float-left">
>                    <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
>                </div>*@
>                <div class="float-right">
>                    <section id="login">
>                        @Html.Partial("_LoginPartial")
>                    </section>
>                    <nav>
>                        <ul id="menu">
>                            <li>@Html.ActionLink("New Order", "Index", "ClientOrder",null, new {title= "Create New Order for Selected Client"})</li>
>                            <li>@Html.ActionLink("Clients", "Index", "Client",null, new {title= "Clients Maintenance"})</li>
>                            <li>@Html.ActionLink("Operators", "Index", "Operator",null, new {title= "Operators Maintenance"})</li>
>                            <li>@Html.ActionLink("History", "History", "ClientOrder",null, new {title= "View Clients Orders History"})</li>
>                            <li>@Html.ActionLink("About", "About", "Home")</li>
>                            
>                        </ul>
>                    </nav>
>                </div>
>            </div>
>        </header>
>        <div id="body">
>            @RenderSection("featured", required: false)
>            <section class="content-wrapper main-content clear-fix">
>                @RenderBody()
>            </section>
>        </div>
>        <footer>
>            <div class="content-wrapper">
>                <div class="float-left">
>                    <p>© @DateTime.Now.Year - Card Numbers</p>
>                </div>
>            </div>
>        </footer>
>
>        @Scripts.Render("~/bundles/jquery")
>        @Scripts.Render("~/bundles/jqueryval")
>        @RenderSection("scripts", required: false)
>    </body>
></html>
>
>Right now in debug mode it takes a lot of time to show my start page.
>
>Anyway, my question is - I want to introduce auto-complete behavior. I added a js file with the same name as my application and I now need to include it.
>
>Do I need to include it at the bottom?
>
>Do I need to create a bundle for it to use the same syntax?
>
>Thanks in advance.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform