Skip to content

Instantly share code, notes, and snippets.

@danieleli
Created October 16, 2011 21:50
Show Gist options
  • Save danieleli/1291471 to your computer and use it in GitHub Desktop.
Save danieleli/1291471 to your computer and use it in GitHub Desktop.
Google Libraries Resource Manifest
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript" />"
public class ResourceManifest : IResourceManifestProvider {
static readonly string GOOGLE_ROOT = "//ajax.googleapis.com/ajax/libs/{0}/{1}/{2}";
public void BuildManifests(ResourceManifestBuilder builder) {
var manifest = builder.Add();
SetPath(manifest.DefineScript("jquery"), "1.5.2", "jquery.min.js", "jquery.js");
SetPath(manifest.DefineScript("jqueryui"), "1.8.11", "jquery-ui.min.js", "jquery-ui.js").SetDependencies("jquery");
SetPath(manifest.DefineScript("chrome-frame"), "1.0.2", "CFInstall.min.js", "CFInstall.js");
SetPath(manifest.DefineScript("dojo"), "1.6.0", "dojo.xd.js", "dojo.xd.js.uncompressed.js");
SetPath(manifest.DefineScript("ext-core"), "3.1.0", "ext-core.js", "ext-core-debug.js");
SetPath(manifest.DefineScript("mootools"), "1.3.1", "mootools-yui-compressed.js", "mootools.js");
SetPath(manifest.DefineScript("prototype"), "1.7.0.0", "prototype.js", "prototype.js");
SetPath(manifest.DefineScript("scriptaculous"), "1.8.3", "scriptaculous.js", "scriptaculous.js");
SetPath(manifest.DefineScript("swfobject"), "2.2", "swfobject.js", "swfobject_src.js");
SetPath(manifest.DefineScript("yui"), "3.3.0", "yui-min.js", "yui.js");
SetPath(manifest.DefineScript("webfont"), "1.0.19", "webfont.js", "webfont_debug.js");
}
private ResourceDefinition SetPath(ResourceDefinition definition, string version, string fileName, string debugFileName)
{
var path = string.Format(GOOGLE_ROOT, definition.Name, version, fileName);
var debugPath = string.Format(GOOGLE_ROOT, definition.Name, version, debugFileName);
return definition.SetCdn(path, debugPath).SetVersion(version);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment