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

How do I integrate vue-gallery with NuxtJS? #3

Closed
rlam3 opened this issue Sep 26, 2017 · 20 comments · Fixed by #105
Closed

How do I integrate vue-gallery with NuxtJS? #3

rlam3 opened this issue Sep 26, 2017 · 20 comments · Fixed by #105
Labels

Comments

@rlam3
Copy link

rlam3 commented Sep 26, 2017

How do I integrate vue-gallery with NuxtJS as a Plugin? Does it require SSR or no?

@RobinCK
Copy link
Owner

RobinCK commented Oct 2, 2017

Sorry, I'm not competent in this issue, I did not work with nuxt.js

@lomholdt
Copy link
Contributor

lomholdt commented Oct 11, 2017

@rlam3
There are issues using this component when SSR is enabled. It works without any problems though if you disable SSR for this plugin only. Heres how:

  • Make sure you have installed the plugin using npm
  • Add a new vue-gallery.js file to your nuxt plugins folder containing the following:
import Vue from 'vue'
import VueGallery from 'vue-gallery'

Vue.component('gallery', VueGallery)
  • In your nuxt.config.js add { src: '~/plugins/vue-gallery.js', ssr: false } to the plugins array. The ssr: false part is where all the magic happens, since the file is included only on the client-side (https://nuxtjs.org/api/configuration-plugins)

And that's it! vue-gallery will work like this, even when using SSR

@rlam3
Copy link
Author

rlam3 commented Oct 12, 2017

@lomholdt it's strange because it works but cannot find the widget container

Any idea on why this may be? Thanks!

blueimp Gallery: Widget container not found. #blueimp-gallery

@RobinCK
Copy link
Owner

RobinCK commented Oct 12, 2017

@rlam3 what version of the library?

@rlam3
Copy link
Author

rlam3 commented Oct 12, 2017

@RobinCK I'm using the latest version. Thanks.

@RobinCK
Copy link
Owner

RobinCK commented Oct 12, 2017

I want to note that this error was in v1.2.0 version in v1.2.1 fixed

@rlam3
Copy link
Author

rlam3 commented Oct 12, 2017

I think I found my problem. tags need to be implemented between gallery
I've also created a step where other NuxtJS users are able to see in the README.md file as well.

@rlam3
Copy link
Author

rlam3 commented Oct 12, 2017

Are there plans to also integrate a textfield in the gallery mode? It would be nice to have something to describe the images inside the gallery. Thanks!

@rlam3
Copy link
Author

rlam3 commented Oct 31, 2017

@RobinCK I took a look at blueimp and saw that they have a way to integrate a description for each image. Would it be possible that you can turn this feature on with vue-gallery? If so, how? Thanks! Really appreciate your help here.
https://github.com/blueimp/Gallery

@JonasJW
Copy link

JonasJW commented Aug 30, 2018

Thanks @lomholdt this worked but when I do it like this I get:

vue.runtime.esm.js:587 [Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.

Any Idea what this is or how to solve it?

@scottyzen
Copy link

Still can't seem to get this to work.
When my page loads I get this error GET https://mysite.netlify.com/gallery/[object%20Object] 404 and when I click on an image this error blueimp Gallery: Widget container not found. #blueimp-gallery

Anyone have any ideas?

@scottyzen
Copy link

Still can't seem to get this to work.
When my page loads I get this error GET https://mysite.netlify.com/gallery/[object%20Object] 404 and when I click on an image this error blueimp Gallery: Widget container not found. #blueimp-gallery

Anyone have any ideas?

Fixed. Turned out it was a problem with Purgecss removing class names.

@core01
Copy link

core01 commented Oct 13, 2018

@scottyzen Hi Scott, how did you fix the problem with Purgecss and vue-gallery? I want to use vue-gallery with PurgeCSS, but the last removes all styles.

UPDATE
Added whitelistPatternsChildren and everything works well.

@ovsw
Copy link

ovsw commented Dec 6, 2018

@JonasJW I had the same issue, here's how I fixed it: #61

@RobinCK RobinCK mentioned this issue Dec 6, 2018
@mornir
Copy link
Contributor

mornir commented Nov 12, 2019

For anyone wondering about the necessary config for purgeCSS:

whitelistPatternsChildren: [/^blueimp.+/]

@jasonkur
Copy link

jasonkur commented Nov 12, 2019

I have added the plugins above to the nuxt.config.js but getting this error. Does anyone know why?

Invalid or unexpected token

@mornir
Copy link
Contributor

mornir commented Nov 12, 2019

Did you add .client.js at the end of the file?
Like this https://github.com/mornir/makeup-website/blob/dev/nuxt.config.js#L54

@jasonkur
Copy link

jasonkur commented Nov 12, 2019

Did you add .client.js at the end of the file?
Like this https://github.com/mornir/makeup-website/blob/dev/nuxt.config.js#L54
Yes, I tried following your files but still get the same error

nuxt.config.ts
plugins: [
    '~/ui/index.ts',
    '~/plugins/getApp.ts',
    { src: '~/plugins/swiper.ts', ssr: false },
    { src: '~/plugins/vue-gallery.client.ts', ssr: false },
  ],

**vue-gallery.client.ts**
import Vue from 'vue';
import VueGallery from 'vue-gallery';

Vue.component('VGallery', VueGallery);

**component**
import VueGallery from 'vue-gallery';


@mornir
Copy link
Contributor

mornir commented Nov 12, 2019

  1. You don't need to add ssr: false
  2. You shouldn't import VueGallery inside the component
    Does this help solve the problem?

@jasonkur
Copy link

  1. You don't need to add ssr: false
  2. You shouldn't import VueGallery inside the component
    Does this help solve the problem?

ahh thank you! that worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants