-
Notifications
You must be signed in to change notification settings - Fork 109
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
using jquery libraries #59
Comments
Does your code work if you run it with (Also, I hope you're only serving fastboot to bots, because if you serve the HTML to users they're going to see everything weirdly jump when masonry finally takes over and runs in the browser.) I think you're going to need to make sure masonry doesn't even try to load in fastboot because it won't work there. One thing you could try is to move |
Thanks for the reply.
I should be able to avoid loading masonry in fastboot to avoid the first error. |
I think I see what's going on here. masony and flickity (as reported in #68) install themselves via side-effect onto jQuery. We probably need to mark |
My guess above was wrong, because neither of these things has a direct dependency on jQuery, because both consider it optional. They both have have documented steps that are required to make them work as jQuery plugins when building with webpack: https://flickity.metafizzy.co/api.html#flickity-setjquery If you follow those steps, both work with ember-auto-import. I confirmed by adding jquery-bridget, masonry-layout, and flickity to a project and putting this into app.js: import $ from 'jquery';
import jQueryBridget from 'jquery-bridget';
import Masonry from 'masonry-layout';
import Flickity from 'flickity';
// flickity needs both of these steps to get full event support
Flickity.setJQuery( $ );
jQueryBridget( 'flickity', Flickity, $ );
// masonry just need this one
jQueryBridget( 'masonry', Masonry, $ ); After that you'll see that But my recommendation is to use these libraries directly, instead of plugging them into jQuery. Using them via jQuery buys you very little in an Ember app, because you already have the element, so you don't need jQuery to help find it: import Flickity from 'flickity';
export default Component.extend({
didInsertElement() {
new Flickity(this.element, {
// some options
})
}
}); |
Thanks for this Ed |
Hi I'm trying to use masonry-layout with auto-import.
app/routes/blog.js
I get this error, I guess because its trying to run masonry in fastboot maybe?
The text was updated successfully, but these errors were encountered: