Gatsby: Integration of Gatsby into larger site

Created on 18 Oct 2018  路  8Comments  路  Source: gatsbyjs/gatsby

Has anyone integrated gatsby into a large project in which only one part of the web app will be using gatsby? I was curious about any experiences people here have had integrating gatsby as opposed to all the examples in which the entire site seems to be generated by gatsby. I'm trying to integrate gatsby into a larger client repo that uses react as well. I'd appreciate any pluses or limitations in trying to do this. I'm basically only using gatsby for generating documentation pages. Any tips on how I could even try to integrate would be appreciated.

question or discussion

Most helpful comment

Following up on a similar question. Would it be possible to use Gatsby to generate bundle files (js, css, etc) that could then be loaded on a page that's part of a larger site and have the js app bootstrap itself? Also, on that note, is it possible to split vendor dependencies from the build? Or would using something like CRA be a better option in cases like this?

All 8 comments

@pieh I was wondering if you have any experience with this. or any insight you could provide for me.

@josekhon it depends, and there's a few considerations here.

Probably the easiest would be to deploy your documentation site at a route (e.g. /docs), which you can do super easily with pathPrefix. This would let other routes (e.g. /whatever, /this, /other, etc.) pass through to existing content, but then Gatsby should pick up at /docs. It's possible you may need to add in some Apache/Nginx routing to ensure this works and the static content is routed to appropriately.

Would that work for your use case, or are there additional considerations we should factor in?

@josekhon are you referring to the hosted site, or running locally (i.e. on your machine)

@DSchau Never mind, I kind of understand what I need to do now. Thank you!

@josekhon OK! Let us know if you have any other questions, and we'll be happy to help!

Following up on a similar question. Would it be possible to use Gatsby to generate bundle files (js, css, etc) that could then be loaded on a page that's part of a larger site and have the js app bootstrap itself? Also, on that note, is it possible to split vendor dependencies from the build? Or would using something like CRA be a better option in cases like this?

I have a slightly different issue. I would like to integrate a static blog within a larger site structure by injecting it into a container. I have tried reading the static index.html file and inserting it into a container and that mostly works however I then have two sets of html and body tags and the react-helmet plugin doesn't work.

I can edit the html.js file and remove the html and body tags but as the docs specify, they are required.

Is there any way around this or another approach to integrating Gatsby into a container?

@FabriceReynolds found any solution . ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

magicly picture magicly  路  3Comments

KyleAMathews picture KyleAMathews  路  3Comments