mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Add examples at the end of the doc pages
This commit is contained in:
@@ -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 = [
|
||||
'---',
|
||||
|
||||
Reference in New Issue
Block a user