Using fragments from package #39140
Unanswered
RHofmannArma
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm wondering if and how to import fragments from a component library into gatsby to be used in a template query.
We'll have a few sites that all use contentful as a source so that means that the content types will all be the same, in order to make it more maintainable I've created a component library for the react components but would really like to have the fragments that the components use in the library as well, that way we don't need to update them in several places if something changes.
I've tried a few different ways, for example exporting the fragments using the gatsby graphql tag and importing it in the template but usually get a GRAPHQL VALIDATION error. I've currently settled with copying the graphql files from the component library into a directory in src/ during the build process. I feel like there should be cleaner way of doing it.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions