From 4a57bd022948aadcba30cdc77f3f613353b5bf44 Mon Sep 17 00:00:00 2001 From: Andrew Joslin Date: Tue, 20 May 2014 11:07:32 -0600 Subject: [PATCH] chore(docs-generator): make demos take less time to load --- docs/processors/demos.js | 11 +++++++++++ docs/templates/demo_index.template.html | 1 + docs/templates/demo_list.template.js | 1 + docs/templates/demo_script.template.js | 3 +-- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 docs/templates/demo_list.template.js diff --git a/docs/processors/demos.js b/docs/processors/demos.js index 0bccebbae9..dc342d61fa 100644 --- a/docs/processors/demos.js +++ b/docs/processors/demos.js @@ -135,6 +135,17 @@ module.exports = { ) }); + //Write the demo list to current version (eg at /nightly); + docs.push({ + docType: 'demo', + template: 'demo_list.template.js', + outputPath: path.join( + config.get('demos.outputFolder'), + config.get('versionData.current.folder'), + 'demo-list.js' + ) + }); + extraData.demos = allDemos; } }; diff --git a/docs/templates/demo_index.template.html b/docs/templates/demo_index.template.html index cd2d278b83..456b698854 100644 --- a/docs/templates/demo_index.template.html +++ b/docs/templates/demo_index.template.html @@ -8,6 +8,7 @@ <@ endif @> + <@ if doc.demoData and doc.demoData.javascript @> <@ endif @> diff --git a/docs/templates/demo_list.template.js b/docs/templates/demo_list.template.js new file mode 100644 index 0000000000..ea0e899953 --- /dev/null +++ b/docs/templates/demo_list.template.js @@ -0,0 +1 @@ +var DEMOS = <$ demos | json $>; diff --git a/docs/templates/demo_script.template.js b/docs/templates/demo_script.template.js index eb729f52da..99d360c098 100644 --- a/docs/templates/demo_script.template.js +++ b/docs/templates/demo_script.template.js @@ -1,4 +1,3 @@ -var DEMOS = <$ demos | json $>; var DEMO; <@ if doc.demoData @> DEMO = <$ doc.demoData | json $>; @@ -65,7 +64,7 @@ angular.module(<@ if doc.demoData @>'<$ doc.demoData.module $>' }) .filter('humanize', function() { return function(input) { - return input.charAt(0).toUpperCase() + + return input.charAt(0).toUpperCase() + input.substring(1).replace(/[A-Z]/g, function(match, i) { return ' ' + match.toUpperCase(); });