Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(doc-gen, docs-app): create plnkr examples with correct Angular … #15269

Merged
merged 1 commit into from
Oct 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/app/src/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ angular.module('examples', [])
filePromises.push($http.get(exampleFolder + '/' + filename, { transformResponse: [] })
.then(function(response) {

// The manifests provide the production index file but Plunkr wants
// a straight index.html
if (filename === 'index-production.html') {
// Plunkr needs an index file that's simply named index.html
if (filename === 'index-plnkr.html') {
filename = 'index.html';
}

Expand Down
7 changes: 5 additions & 2 deletions docs/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = new Package('angularjs', [
.factory(require('./services/deployments/default'))
.factory(require('./services/deployments/jquery'))
.factory(require('./services/deployments/production'))
.factory(require('./services/deployments/plnkr'))

.factory(require('./inline-tag-defs/type'))

Expand Down Expand Up @@ -150,7 +151,8 @@ module.exports = new Package('angularjs', [
generateProtractorTestsProcessor,
generateExamplesProcessor,
debugDeployment, defaultDeployment,
jqueryDeployment, productionDeployment) {
jqueryDeployment, productionDeployment,
plnkrDeployment) {

generateIndexPagesProcessor.deployments = [
debugDeployment,
Expand All @@ -170,7 +172,8 @@ module.exports = new Package('angularjs', [
debugDeployment,
defaultDeployment,
jqueryDeployment,
productionDeployment
productionDeployment,
plnkrDeployment
];
})

Expand Down
49 changes: 49 additions & 0 deletions docs/config/services/deployments/plnkr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';
// Special deployment that is only used for the examples on plnkr.
// While the embedded examples use the Angular files relative the docs folder,
// plnkr uses the CDN urls, and needs to switch between Google CDN for tagged versions
// and the code.angularjs.org server for the snapshot (master) version.

var versionInfo = require('../../../../lib/versions/version-info');
var isSnapshot = versionInfo.currentVersion.isSnapshot;

var cdnUrl = isSnapshot ?
'//code.angularjs.org/snapshot' :
'//ajax.googleapis.com/ajax/libs/angularjs/' + versionInfo.cdnVersion;

module.exports = function plnkrDeployment(getVersion) {
return {
name: 'plnkr',
examples: {
commonFiles: {
scripts: [cdnUrl + '/angular.min.js']
},
dependencyPath: cdnUrl + '/'
},
scripts: [
cdnUrl + '/angular.min.js',
cdnUrl + '/angular-resource.min.js',
cdnUrl + '/angular-route.min.js',
cdnUrl + '/angular-cookies.min.js',
cdnUrl + '/angular-sanitize.min.js',
cdnUrl + '/angular-touch.min.js',
cdnUrl + '/angular-animate.min.js',
'components/marked-' + getVersion('marked', 'node_modules', 'package.json') + '/lib/marked.js',
'js/angular-bootstrap/dropdown-toggle.min.js',
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
'js/versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/docs.min.js'
],
stylesheets: [
'components/bootstrap-' + getVersion('bootstrap') + '/css/bootstrap.min.css',
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
'css/prettify-theme.css',
'css/docs.css',
'css/animations.css'
]
};
};