Hello all!
I included jquery-ui from CDN in HEAD section of main html template and get jquery-ui.js:14 Uncaught ReferenceError: jQuery is not defined
error.
I’m using Meteor 1.3, meteor list
shows me jquery package installed
Also I found similar question with no answer.
How to solve this “meteor” way?
Thank you!
Manipulating the head is nearly never necessary with Meteor. Just add the jquery UI package from Atmosphere https://atmospherejs.com/mizzao/jquery-ui
@waldgeist , what if I am going to use some other jquery-based package not listed in Atmosphere?
Before Meteor 1.3, the most convenient and easy way to do this was mquandalle:bower
, which allows you to download plugins from Bower. Most jQuery plugins are there.
To make this re-usable across projects, you can also wrap the bower download in a local package, so you can re-use this package in multiple projects. I could send you a sample package for slick carousel which I built.
Meteor 1.3 now has a tight integration with npm, so it should be even easier with this version. But as my apps are still on 1.2, I don’t have much experience with this. Should be as easy as npm install <your-jquery-plugin>
, though.
@waldgeist , thanks for your reply!
I suppose the solution somehow can be connected with import
statement.
import body template???
I even read some ideas here on forum but can not find them now…
1 Like
IIRC imports shouldn’t be necessary for jQuery plugins, as they register themselves to an existing jQuery instance without polluting the global namespace. I’d just try it out
1 Like