mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-17 02:56:57 +02:00
feat: prototype custom pages site generation
This commit is contained in:
parent
cf08a20737
commit
bc7b2835b0
8 changed files with 78 additions and 9 deletions
23
lib/load/pages.js
Normal file
23
lib/load/pages.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const globby = require('globby');
|
||||
const {encodePath, fileToPath} = require('./utils');
|
||||
|
||||
async function loadPages(pagesDir) {
|
||||
const pagesFiles = await globby(['**/*.js'], {
|
||||
cwd: pagesDir
|
||||
});
|
||||
|
||||
const pagesData = await Promise.all(
|
||||
pagesFiles.map(async source => {
|
||||
const filepath = path.resolve(pagesDir, source);
|
||||
return {
|
||||
path: encodePath(fileToPath(source)),
|
||||
source
|
||||
};
|
||||
})
|
||||
);
|
||||
return pagesData;
|
||||
}
|
||||
|
||||
module.exports = loadPages;
|
Loading…
Add table
Add a link
Reference in a new issue