larabel's avatar

Correct way to install PhotoSwipe gallery ?

Hello,

I try to install PhotoSwipe gallery but had JS errors on html page -

"Uncaught ReferenceError: PhotoSwipeUI_Default is not defined"

As I understand it's because not all JS includes correctly.

Can anybody explain how to correctly install PhotoSwipe? It's possible with Mix?

PS: I try to install in this way:

yarn add photoswipe

in bottom of resources/assets/js/bootstrap.js I add

window.PhotoSwipe = require('photoswipe');

npm run dev

0 likes
3 replies
Tomi's avatar

Probably something like this:

import PhotoSwipe from "photoswipe";
import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default';
1 like
larabel's avatar

Thanks a lot!

And how to publish photoswipe/dist/default-skin/ files (default-skin.css, default-skin.png..) ? mix.copy and {{asset}} in template ?

1 like
Tomi's avatar
Tomi
Best Answer
Level 8

you can tell mix from where to where it should copy files (images or what ever):

mix.copy('resources/assets/images', 'public/images');

your images are probably in under node_modules/photoswipe 

Please or to participate in this conversation.