Skip to content

Commit 466ad52

Browse files
committed
fix(tools): add docsComponentsSubpath configuration option, defaults to components
1 parent 1e204fa commit 466ad52

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

tools/pfe-tools/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ interface SiteOptions {
1313
stylesheets?: string[];
1414
/** Title for main page of the demo */
1515
title?: string;
16-
/** Site subpath for components. e.g. 'elements'. default: 'components' */
16+
/** Site subpath for components. e.g. 'elements'. default: 'elements' */
1717
componentSubpath?: string;
18+
//* Docs site subpath for components. e.g. 'components'. default: 'components' */
19+
docsComponentSubpath?: string;
1820
}
1921

2022
export interface PfeConfig {
@@ -41,6 +43,7 @@ const SITE_DEFAULTS: Required<SiteOptions> = {
4143
stylesheets: [],
4244
title: 'PatternFly Elements',
4345
componentSubpath: 'elements',
46+
docsComponentSubpath: 'components',
4447
};
4548

4649
const DEFAULT_CONFIG: PfeConfig = {

tools/pfe-tools/custom-elements-manifest/demos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import slugify from 'slugify';
2929
export function demosPlugin(options?: PfeConfig): Plugin {
3030
const fileOptions = getPfeConfig(options?.rootDir);
3131
const config = { ...fileOptions, ...options };
32-
const subpath = config.site.componentSubpath ?? 'components';
32+
const subpath = config.site.docsComponentSubpath ?? 'components';
3333
const { rootDir, demoURLPrefix, sourceControlURLPrefix } = config;
3434
return {
3535
name: 'demos-plugin',

tools/pfe-tools/custom-elements-manifest/lib/Manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export class Manifest {
274274
* > **ANY** (_>= 0x_)
275275
* `/demo`
276276
*/
277-
const DEMO_PATH_RE = new RegExp(`/${options.site.componentSubpath}/(.*)/demo`);
277+
const DEMO_PATH_RE = new RegExp(`/${options.site.docsComponentSubpath}/(.*)/demo`);
278278
let [, slug = ''] = permalink.match(DEMO_PATH_RE) ?? [];
279279
// strict removes all special characters from slug
280280
slug = slugify(slug, { strict: true, lower: true });

0 commit comments

Comments
 (0)