Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mixing bundles and regular script?
Message
De
27/10/2012 04:12:35
 
 
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:
01555909
Message ID:
01555924
Vues:
41
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>It is OK to include into layout.cshtml these lines as is:
>
>
><!-- DataTables CSS -->
><link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
> 
><!-- jQuery -->
><script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
> 
><!-- DataTables -->
><script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
>
>?
>
>My MVC project is for ASP.NET MVC 4 and they use a concept of bundles. However, as I understand from intellisense help, I need to supply virtual path if I am to use bundle.
>
>
>In other words, this compiles, but I am not sure if this is correct usage:
>
>
> bundles.Add(new ScriptBundle("~/bundles/jquery.dataTables").Include("http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js","http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"));
>
>
>UPDATE. Working through this blog post now http://www.tomdupont.net/2012/03/configuring-bundles-in-mvc-4.html
>So far I managed to break the already working page, but hopefully will succeed at the end.
>Thanks in advance.

I think you can use BundleCollection.UseCdn which also allows for fallback if the CDN is not available.
See 'Using a CDN' here: http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform