Main.js and Isotope don't want to work together

Hi everyone

I am using bower install to install isotope to run a wordpress plugin. Everything looks fine in my bower.json.

I have added Isotope as a dependency on my manifest.json (I think it’s useful but i’m not sure…) :

"jquery.isotope.js": {
      "bower": ["isotope"]
}

Then, the wordpress plugin is not working. But my main.js works.

I have tried to add Isotope as a dependency inside my assets.php :

  wp_enqueue_script('sage_js', asset_path('scripts/main.js'), ['jquery','isotope'], null, true); 

And it works !! But my main.js is no longer working…
In fact, my wp_enqueue_script is crashing when I wrote it like that, that is why isotope is running… I can remove the line and isotope is still running.

I have two questions :

  • How Isotope is loaded inside my page, since I haven’t add it…?
  • Why my main.js is not loaded if there is more than one dependency inside the wp_enqueue_script…?
  • How can I add isotope and my main.js…?

Thanks a lot !

1 Like

@austin covered Isotope on this blog post: https://roots.io/using-bootstrap-with-bower-how-to-override-bower-packages/

2 Likes

That’s perfect :smile:

I was looking for a solution since 2 hours… Thanks a lot !