Add examples at the end of the doc pages

This commit is contained in:
Christopher Chedeau
2015-03-31 12:28:26 -07:00
parent c8c4b41827
commit a4a551c571
2 changed files with 32 additions and 0 deletions

View File

@@ -25,6 +25,17 @@ function getNameFromPath(filepath) {
return filepath;
}
function getExample(componentName) {
var path = '../Examples/UIExplorer/' + componentName + 'Example.js';
if (!fs.existsSync(path)) {
return;
}
return {
path: path,
content: fs.readFileSync(path).toString(),
};
}
function componentsToMarkdown(type, json, filepath, i, styles) {
var componentName = getNameFromPath(filepath);
@@ -38,6 +49,7 @@ function componentsToMarkdown(type, json, filepath, i, styles) {
if (styles) {
json.styles = styles;
}
json.example = getExample(componentName);
var res = [
'---',