metafizzy / flickity-fade

Fade between Flickity slides
62 stars 18 forks source link

NPM Usage Question #3

Closed celsowhite closed 5 years ago

celsowhite commented 5 years ago

Hi, appreciate the work on this! I am a bit confused how to use this with standard webpack builds.

Question

If using import Flickity from "flickity-fade". Can I initialize all of my flkty instances with that import and will they behave just like import Flickity from "flickity".?

I ask because I'm using code splitting and would like to keep my instance imports the same across my application regardless of if they are using the slide or fade effect.

Investigation

From looking at the code it appears you are requiring the main Flickity package and returning it. So we should technically be able to just use this package to initialize but I'd like to double check.

Suggestion

I would make this section of the readme clearer for those users that want to use a combination of fade and slide effects across their site. I.E if a user is using a combination of fade and slide effects they have to install both packages but can initialize all instances with 'flickity-fade'.

desandro commented 5 years ago

If using import Flickity from "flickity-fade". Can I initialize all of my flkty instances with that import and will they behave just like import Flickity from "flickity".?

Yes. flickity-fade has flickity as a dependency. So by importing 'flickity-fade' you get the standard flickity package PLUS fade functionality from flickity-fade.

I appreciate the suggestion. Typically I lean to only the most straightforward examples, rather than trying to broach every edge case.

celsowhite commented 5 years ago

Thanks @desandro. Totally understand re: suggestion.