How to include jQuery UI

I have created a Meteor package for jQuery, simply by downloading the jQuery files from their website and including them in a Meteor package formatted like so:

 Package.onUse(function(api) {
  api.versionsFrom('1.0.3.1');
  api.addFiles('jquery-2.1.3/jquery-2.1.3.js','client');
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('jquery-2.1.3');
  api.addFiles('jquery-2.1.3-tests.js');
});

I am having issues getting this to work without error, i.e. I get an ‘undefined is not a function’ error.It may be because the meteor-platform package adds jQuery by default, so causing a conflict. Can someone confirm whether:

  1. it is possible to have a version of jQuery in my Meteor project other than the one installed by meteor-platform and,
  2. if so, how to go about it?

It’s actually pretty easy to replace jQuery.

  1. Create packages/jquery directory inside your meteor app
  2. Place all files from meteor’s own jquery package but replace jquery.js with your own. (You may have to change the Github branch/tag to your meteor version)

I’m not sure whether replacing jQuery can cause any issues. Better talk to some Meteor folks about that.

2 Likes