mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 01:57:28 +02:00
perf(v2): smaller bundlesize by embedding metadata to content (#2088)
* wip embed metadata to content * embed metadata in blog as well * refactor * update test * yarn lock * avoid overwriting file everytime we run new nodejs process * nits
This commit is contained in:
parent
32c9d07b90
commit
7f8aca2ddc
16 changed files with 236 additions and 200 deletions
|
@ -8,7 +8,7 @@
|
|||
import globby from 'globby';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import {encodePath, fileToPath} from '@docusaurus/utils';
|
||||
import {encodePath, fileToPath, aliasedSitePath} from '@docusaurus/utils';
|
||||
import {LoadContext, Plugin} from '@docusaurus/types';
|
||||
|
||||
import {PluginOptions, LoadedContent} from './types';
|
||||
|
@ -51,8 +51,7 @@ export default function pluginContentPages(
|
|||
|
||||
return pagesFiles.map(relativeSource => {
|
||||
const source = path.join(pagesDir, relativeSource);
|
||||
// Cannot use path.join() as it resolves '../' and removes the '@site'. Let webpack loader resolve it.
|
||||
const aliasedSource = `@site/${path.relative(siteDir, source)}`;
|
||||
const aliasedSource = aliasedSitePath(source, siteDir);
|
||||
const pathName = encodePath(fileToPath(relativeSource));
|
||||
// Default Language.
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue