Gatsby: [gatsby-source-prismic] Need to kill and restart gatsby develop server to see new published content

Created on 29 Sep 2017  路  10Comments  路  Source: gatsbyjs/gatsby

Hey,

We're using Gatsby with Prismic.io and the gatsby-source-prismic plugin as backend. What we need would be Gatsby to watch new content from Prismic.io without having to kill the server and restart every time new content is published.

We use the createPages API to create new route each time something's new on Prismic.

Is this possible ?

question or discussion

Most helpful comment

Kinda aiming for this kind of workflow:

which I think would be a pretty amazing recipe with Gatsby

https://futurice.com/blog/cms-done-right-vol-3

All 10 comments

Hi @mikedotJS At the moment Gatsby need to rebuild to incorporate new content. How would you do that in Gatsby API ?

@mikedotJS this is very possible! It's not a pattern that's been explored thoroughly in source plugins but the source plugin API is designed to allow for this use case.

An source plugin that does this is gatsby-source-filesystem. It watches for new files to be added to the filesystem and creates new nodes whenever it see a new file (or updates an existing one).

The prismic plugin could be altered to do this as well e.g. periodically check the Prismic API if there's been new content added. If Prismic has a way to auto-register a webhook, that'd be even better.

Also another idea I've had is that we could expose a way to re-run source plugins while the development server is running. So if you know someone added content to Prismic, you could go to the CLI where the development server is running and trigger checking for new source data.

Also createPages already is run whenever new nodes are added so nothing new would need done there.

@KyleAMathews prismic does indeed have a webhook for that -> here.

@aulneau that's for setting up production builds. @mikedotJS is asking about auto-pulling content during development. Prismic's webhook wouldn't work for this as we'd want something that could be setup only for a finite-length development session through their node.js library.

I'd love to see a solution to this. Would this be useful in any way?
https://www.npmjs.com/package/prismic-static

Has anyone tried to spin a dev server to implement prismic preview feature ? It seems it would need to be able to discover new content on refresh as well.

https://prismic.io/blog/improvement-live-preview-in-website

Kinda aiming for this kind of workflow:

which I think would be a pretty amazing recipe with Gatsby

https://futurice.com/blog/cms-done-right-vol-3

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

So has this problem solved yet?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  路  3Comments

totsteps picture totsteps  路  3Comments

benstr picture benstr  路  3Comments

theduke picture theduke  路  3Comments

hobochild picture hobochild  路  3Comments