yaquawa / jquery.photoswipe

The jQuery plugin for PhotoSwipe
91 stars 35 forks source link

Babel complaining #7

Closed ursbraem closed 8 years ago

ursbraem commented 8 years ago

When I compile the jquery.photoswipe-global.js file with foundation's gulp task, Babel complains about it being too large.

[BABEL] Note: The code generator has deoptimised the styling of "/path/to/node_modules/jquery.photoswipe/dist/jquery.photoswipe-global.js" as it exceeds the max of "100KB".

This doesn't seem to be an issue, just a note. But (among others, to prevent that message) could I also include the original js from photoswipe and just add your code on top – would that be equivalent?

yaquawa commented 8 years ago

Yes, technically you can.

But this is a little tricky... because I use the Browserify to compile my code. So the original PhotoSwipe is imported into my code, that way you don't need to include it yourself, also hide the PhotoSwipe from the global namespace which is considered as a "best practice".

By the way, if you use Browserify or Webpack or Rollup... You should import the plugin like this.

import PhotoSwipeMounter from 'jquery.photoswipe';

PhotoSwipeMounter(jQuery); // mount this plugin into jQuery
ursbraem commented 8 years ago

I understand. I'll try to live with the notice :-)

I'm using foundation 6 – actually there are so many built in tools I don't know if Browserify or Webpack or Rollup are running there.

Also by the way: you include the CSS and buttons from the original photoswipe plugin. Do you manage to compile the css and assets directly into your /dist/ with your setup? I've been biting my teeth out on that, cf. http://stackoverflow.com/q/40328145/160968

yaquawa commented 8 years ago

Unfortunately no, css or images come with PhotoSwipe should be maintained by the author of PhotoSwipe. After all, this is a javascript library.

I always manage non-js assets by myself, so I could change them as I want them to be, while the javascript library shouldn't be altered by yourself in general speaking.

ursbraem commented 8 years ago

I see! It's just so tedious to always copy those assets around. Maybe because I'm new to bower, npm et al I just wanted to manage everything by it... Thanks for everything!