From 4a4b28dbf3af9a1871f00dfeded6da9eda557412 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 20 Aug 2012 08:28:04 -0700 Subject: chore(docs): use GAE and Google CDN for docs Short summary: if you use local node server everything should work as before, if you use GAE, everything should work now as well, but we pull assets from CDN. - GAE doesn't support ':' in filenames, so I had to replace it with '_' but only in the filename, all servers were reconfigured to rewrite the urls from : to _ when doing file lookup - We now pull angular assets from google CDN when deployed on GAE (locally or in production). When running on a non GAE server we pull assets from ../ directory as before - Since only certain versions of Angular are available on CDN and we want to be able to autodeploy docs, I had to pin down the Angular files to a "stable" version when running on GAE --- docs/src/templates/index.html | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'docs/src/templates/index.html') diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index 4c6dc2cb..49a1beec 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -22,8 +22,13 @@ baseUrl = location.href.replace(rUrl, indexFile), jQuery = /index-jq[^\.]*\.html$/.test(baseUrl), debug = /index[^\.]*-debug\.html$/.test(baseUrl), + gae = (baseUrl.split('/').length == 4), headEl = document.getElementsByTagName('head')[0], - sync = true; + sync = true, + angularVersion = { + current: '"NG_VERSION_FULL"', // rewrite during build + stable: '"NG_VERSION_STABLE"' + }; addTag('base', {href: baseUrl}); addTag('link', {rel: 'stylesheet', href: 'css/bootstrap.min.css', type: 'text/css'}); @@ -40,6 +45,20 @@ addTag('script', {src: 'js/docs-keywords.js'}, sync); function path(name) { + if (gae) { + if (name.match(/^angular(-\w+)?\.js/) && !name.match(/bootstrap/)) { + name = '//ajax.googleapis.com/ajax/libs/angularjs/' + + angularVersion.stable + + '/' + + name.replace(/\.js$/, '.min.js'); + } else { + name = 'http://code.angularjs.org/' + + angularVersion.stable + + '/' + + name.replace(/\.js$/, '-' + angularVersion.stable +'.min.js'); + } + return name; + } return '../' + name.replace(/\.js$/, debug ? '.js' : '.min.js'); } -- cgit v1.2.3