diff --git a/docs/config/services/deployments/production.js b/docs/config/services/deployments/production.js index f0de9890278c..112d20889520 100644 --- a/docs/config/services/deployments/production.js +++ b/docs/config/services/deployments/production.js @@ -1,16 +1,30 @@ 'use strict'; var versionInfo = require('../../../../lib/versions/version-info'); -var cdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/' + versionInfo.cdnVersion; + +var googleCdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/'; +var angularCodeUrl = '//code.angularjs.org/'; + +var cdnUrl = googleCdnUrl + versionInfo.cdnVersion; + +// The plnkr examples must use the code.angularjs.org repo for the snapshot, +// and the cdn for the tagged version and, if the build is not tagged, the currentVersion. +// +// The currentVersion may not be available on the cdn (e.g. if built locally, or hasn't been pushed +// yet). This will lead to a 404, but this is preferable to loading a version with which the example +// might not work (possibly in subtle ways). +var examplesCdnUrl = versionInfo.isSnapshot ? + (angularCodeUrl + 'snapshot') : + (googleCdnUrl + (versionInfo.version || versionInfo.currentVersion)); module.exports = function productionDeployment(getVersion) { return { name: 'production', examples: { commonFiles: { - scripts: [cdnUrl + '/angular.min.js'] + scripts: [examplesCdnUrl + '/angular.min.js'] }, - dependencyPath: cdnUrl + '/' + dependencyPath: examplesCdnUrl + '/' }, scripts: [ cdnUrl + '/angular.min.js',