You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/pages/docs/custom-templates.mdx
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,12 @@ module.exports = {
99
99
100
100
When you use the CLI with `--out-dir` option, an index file is automatically generated.
101
101
102
-
The customization is the same, a file that exports a function:
102
+
The customization is the same, a file that exports a function. The function receives an argument that is an array containing objects made of the original file path and the path of the file containing the generated React component:
103
+
104
+
-`originalPath`: the original file's path
105
+
-`path`: the React component's file's path
106
+
107
+
Default template only uses `path` and it is similar to this:
103
108
104
109
```js
105
110
constpath=require('path')
@@ -116,6 +121,37 @@ function defaultIndexTemplate(filePaths) {
116
121
module.exports= defaultIndexTemplate
117
122
```
118
123
124
+
but you could implement a more advanced template exploiting the original file name too:
0 commit comments