Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Story Templating #88

@megazear7

Description

@megazear7

Could client projects configure a template that is used when creating stories with the sba story command? This way they could provide their own format, with their own modifications. The current story template from story-config.js is shown below. Right now this is the only template that can be used and is not able to be modified by the client project.

render() {
  return `
    const ${this.contentPathIdentifier} = "${this.contentPath}";
    export const ${this.identifier} = () => ({
        template: async () => fetchFromAEM(${this.contentPathIdentifier})
    });
    ${this.identifier}.story = {
        name: '${this.prettyName}',
        parameters: { }
    };
  `;
}

I think the idea would be to look at the default export of .storybook/story.template.js for a string literal and pass it the same data we are passing the above string literal. If no such file exists then we fall back to the above 'default' template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions