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

Global site/config values #20

Open
4 tasks
aileen opened this issue Jan 11, 2019 · 1 comment
Open
4 tasks

Global site/config values #20

aileen opened this issue Jan 11, 2019 · 1 comment
Labels
enhancement Improvement/enhancement of existing features

Comments

@aileen
Copy link
Member

aileen commented Jan 11, 2019

Problem description

Throughout the codebase we're using values that either come from the starter specific siteConfig.js, or - via Content API - the Ghost settings (like here for example, where we run a StaticQuery in order to use both sources).

Ideally those would be merged together in one site or config, so it's easily accessible by other components/modules.

The biggest pain point here is, that we need the values from the Ghost settings already in the gatsby-config.js! Because of the unavailability of the Ghost settings in this file, we had to create a workaround and adjust the gatsby-offline-manifest plugin (👉 see PR here #15)

This is due to Gatsby's specific lifecycle that allows to run GraphQL queries only after the first schema creation. This means at the point when Gatsby is processing the config file, it simply doesn't know about Ghost settings yet.

Proposal

Create a script, that runs before any Gatsby activities and fetches the data from the settings endpoint via Content API (without gatsby-source-ghost usage) and make those merged values available in gatsby-config (and ofc any other occurrences). This can be a .json file for example that get's replaced with every build.

Todos

@aileen aileen added the enhancement Improvement/enhancement of existing features label Jan 11, 2019
@styxlab
Copy link
Contributor

styxlab commented Feb 11, 2020

Is this enhancement still of interest or did you find a better approach in the meantime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement/enhancement of existing features
Projects
None yet
Development

No branches or pull requests

2 participants