The usage of CDN in ScriptRegistrar is still not clear to me
I have two differents cases to submit to your perspicacity.
A) local scripts referencing an external CDN
Let's suppose I am developping two small googlemap scripts:
- myMap1.js
- myMap2.js
Both reference an external CDN :http://www.google.com/jsapi
My frst idea was to create a group I named Google and add into it my two scripts
<add name="Google" defaultPath="~/Scripts/Google/" contentDeliveryNetworkUrl="http://www.google.com/jsapi">
<items>
<add source="myMap1.js"/>
<add source="myMap2.js"/>
</items>
</add>
This did not work and produces only a link to http://www.google.com/jsapi
The second idea was to codify everything
Html.Telerik().ScriptRegistrar().Scripts.AddGroup("myMaps", g=>g
.Add("http://www.google.com/jsapi")
.Add("/Google/myMap1.js")
.Add("/Google/myMap1.js")
)
This also fails with '~/Scripts/http://www.google.com/jsapi' is not a valid virtual path.
So what's the best to handle this case?
Why there is no way to add an external CDN link with the need to create a group
I ended up creating two groups: one for the CDN and one for the two local scripts. (not really clean but...)
B) I guess this one is more common need.
A many, I usually use Google CDN for my jQuery
- http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
- http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js
I however did not find the way to put these tow common scripts in the same group
Thanks for your help