Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use jQuery UI in meteor?

What is the correct way to install jQuery UI in a Meteor application? Since it's not a package yet, I added the jquery-ui.min.js and jquery-1.8.3.js that came in the download into the lib folder in my meteor project. That is causing the following fatal error:

Your app is crashing. Here's the latest log.
app/lib/jquery-1.8.3.js:9472
})( window );

ReferenceError: window is not defined
at app/lib/jquery-1.8.3.js:9472:5

(.........)

Exited with code: 1
Your application is crashing. Waiting for file change.
like image 493
Alex Getty Avatar asked Dec 26 '12 15:12

Alex Getty


3 Answers

I have actually added a jquery-ui meteorite package that you can install

mrt add jquery-ui

Note this package is version 1.8.16 and is a dependency of the jquery-ui-bootstrap package which, if installed, will automatically include the jquery-ui and bootstrap-updated smart packages. (All of which make bootstrap and jquery-ui play nicely together).

To install everything, you can use: mrt add jquery-ui-bootstrap

like image 94
TimDog Avatar answered Nov 03 '22 00:11

TimDog


You need to put jquery UI in the client directory otherwise it is loaded by Meteor on both client and server and crash your app.

like image 42
WispyCloud Avatar answered Nov 03 '22 00:11

WispyCloud


I've created an alternative jquery-ui package for Meteor that also includes images:

https://github.com/mizzao/meteor-jqueryui

Use mrt add jqueryui (note there's no dash) to install it. I know, this Meteor package proliferation sucks, due to things not getting maintained. But it should all get better soon when Meteor releases its official packaging system.

like image 41
Andrew Mao Avatar answered Nov 02 '22 23:11

Andrew Mao