Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide a config file to the custom-template #47

Open
hugo1o1 opened this issue Aug 11, 2021 · 2 comments
Open

provide a config file to the custom-template #47

hugo1o1 opened this issue Aug 11, 2021 · 2 comments

Comments

@hugo1o1
Copy link

hugo1o1 commented Aug 11, 2021

Is your feature request related to a problem? Please describe.
I mean, it helps a lot when you can add a custom template. But if it is possible to provide a config file to our custom templates, like a regular exp replace or to generate a comonent with more options

for example
there are so many pages with the same layout, but diff in some details like a seach form with different fields , or table with unlike columns

@mosesoak
Copy link

I also need this feature for stories. We are using the atomic design pattern and need to be able to generate stories with

export default {
  title: '${folder}/TemplateName',
  component: TemplateName,
} as ComponentMeta<Component>;

for like 'atoms/Heading'.

For now I guess I'll use a node script to sed-replace some text after generation but, that's kinda what a generator does so it's a shame there's no custom parameters option. Thanks for considering it!

@TyIsI
Copy link
Contributor

TyIsI commented Jul 29, 2023

Not sure if this is still an issue. But have you considered using different templates for this?

For Example

{
    ...
        "atom": {
            "path": "src/components/atoms",
            "withLazy": true,
            "withStory": true,
            "withStyle": true,
            "withTest": true,
            "withTypes": true,
            "withConfig": true,
            "customTemplates": {
                "component": "src/templates/atoms/TemplateName.tsx",
                "config": "src/templates/atoms/TemplateName.config.ts",
                "lazy": "src/templates/atoms/TemplateName.lazy.tsx",
                "story": "src/templates/atoms/TemplateName.stories.tsx",
                "style": "src/templates/atoms/TemplateName.module.css",
                "test": "src/templates/atoms/TemplateName.test.tsx",
                "types": "src/templates/atoms/TemplateName.types.ts"
            }
        },
        "atom-subtype1": {
            "path": "src/components/atoms",
            "withLazy": true,
            "withStory": true,
            "withStyle": true,
            "withTest": true,
            "withTypes": true,
            "withConfig": true,
            "customTemplates": {
                "component": "src/templates/atoms/subtype-1/TemplateName.tsx",
                "config": "src/templates/atoms/TemplateName.config.ts",
                "lazy": "src/templates/atoms/TemplateName.lazy.tsx",
                "story": "src/templates/atoms/TemplateName.stories.tsx",
                "style": "src/templates/atoms/TemplateName.module.css",
                "test": "src/templates/atoms/TemplateName.test.tsx",
                "types": "src/templates/atoms/TemplateName.types.ts"
            }
        },
        "molecule": {
            ...
        },
        "particle": {
            ...
        },
        // etc
        ...
}

Though - if @arminbro agrees - I could see a post processor option work here and I might be interested in submitting a PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants