prismicio / prismic-vue

Vue plugin, components, and composables to fetch and present Prismic content
https://prismic.io/docs/technologies/vuejs
Apache License 2.0
65 stars 16 forks source link

SSR Capable? #3

Closed johndigital closed 4 years ago

johndigital commented 6 years ago

Love that you guys are working on this, going to be so helpful! I've noticed all the documentation assumes a browser environment, but I'm using Nuxt so my Vue components are getting rendered on the server. Any chance there are plans to make this SSR capable?

Maybe it is now but I couldn't get it working, I tried but it was throwing errors. For now I'm just using the prismic-javascript package to handle my data.

debiasio commented 6 years ago

Hello @johndigital,

Thanks for your kind words. Yes, we would like to make the prismic-vue SSR capable. We haven't work on it immediately for not delaying the release of the plugin and the docs. I am now working on a refactoring of the plugin that will allow to use it without the need to include the vue-compiler.

benoitemile commented 6 years ago

Hello @johndigital,

We're also using nuxt x prismic, and it's working real fine. What we did :

Hope that is explicit enough, if not, maybe i'll bootstrap a sample nuxt x prismic project so people can onboard with no hassle.

johndigital commented 6 years ago

Hey @benoitemile,

Thank you, I appreciate the help! I think I've done something quite similar in my case, essentially wrapping the prismic-javascript package into a service that can be used throughout my app in both node and browser environments.

It works great, but I really like the idea of this prismic-vue plugin so I could use all the helper methods that have been built. The workflow outlined in this documentation using the injected $prismic namespace seems really nice to me.

debiasio commented 6 years ago

Hello @johndigital and @benoitemile,

Today I have made a test to include the prismic-vue plugin in a Nuxt project, so I confirm it doesn't work. In the future I will update the plugin to make it work with Nuxt. For now you have to manage yourself a way to use our prismic-javascript kit in your Nuxt project and refer to our generic JavaScript documentation.

@benoitemile It would be great if you can publish on GitHub a sample project Nuxt + Prismic that uses the prismic-javascript kit.

johndigital commented 6 years ago

Thanks @jbdebiasio I appreciate this update! Would love to help if possible, let me know if there's some part of this I could work on easily and maybe I can put together a PR.

The biggest obstacle for me is that everything seems to be working off the assumption that the prismic library is installed on the window global. I'm not sure how you would best want to decouple that and have it continue to work with your other tooling/libraries.

benoitemile commented 6 years ago

hi @jbdebiasio,

I also would love to help on achieving prismic-vue to be nuxt compliant, let's make it happen. About sample project, i'm totally okay, do you have a "prismic test" repository ?

dan-gamble commented 6 years ago

Hey @johndigital and @benoitemile i'm also interested in SSR rendering. Luckily i came across this repo. This has an example of the prismic javascript kit implemented to work with SSR. Mainly the prismic-configuration and plugins/prismic.

Hope this is helpful until this plugin supports SSR.

johndigital commented 6 years ago

This is really cool @dan-gamble, great find and thank you for sharing!

uglow commented 6 years ago

Hi @jbdebiasio, any progress on making this library compatible with Nuxt.js? We are evaluating using Prismic for a government client at the moment. Easy integration with Nuxt.js is a key capability for us.

debiasio commented 6 years ago

Hi @uglow, I want to do it before December, I am busy on other projects now. I will let you know.

mcrider commented 6 years ago

I just integrated prismic with my nuxt app using https://github.com/jamespegg/prismic-nuxt -- Just ran some tests and it looks to be working well with SSR, not sure if I'll run into any gotchas at some point but its a pretty straightforward plugin.

Ralph-Imholz commented 5 years ago

@jbdebiasio any update on this?

phillysnow commented 5 years ago

You can now use the Nuxt.js branch of the Vue Kit for SSR

npm install https://github.com/prismicio/prismic-vue.git#nuxt