Sage 9 Adding and Enqueueing A JS Library


I’m having trouble installing and using a JS library, specifically Flexslider. I have used yarn add flexslider and can see the files in the node_modules but when I try use the script it says that ‘flexslider is not a function’, usually meaning it has not been compiled or enqueued correctly. Is there an additional step once the library has been added?

Thank you

I had this same question and Ben was kind enough to answer with a reference to the documentation. I keep forgetting that the docs are reasonably up to date on Git, just not here yet.

There do seem to be a few inconsistencies with the precise method. I’m not sure yet how to determine when a simple import statement will work and when you need to import the class by name but that should get you started at least!

@MWDelaney Thanks for your response. I had a google about but couldn’t find the docs. Embarrassingly simple and frustrating! Cheers

Could one call this a paradigm shift? Instead enqueuing script or style files these are baked into a single minified JS/CSS file and globally enqueued for the theme?
Would it still be easily possible to write webpack code that expects an enqueued script?