JS plugins, ok for Meteor?

I'm trying to incorporate a Twitter Bootstrap template with Meteor and I'm having trouble understanding how I should include files. For example, let's start with Bootstrap itself, should I install it with Meteor/Meteorite or do it manually with script includes? Same for other javascript plugins (e.g. jquery <- this one is builtin to Meteor right?, lightbox.js.. etc.)

Hope I'm making sense, thanks!

Answers


By default meteor already includes jquery.

It's best to look to get your plugins installed via Meteorite. So something like this could get you started

sudo -H npm install -g meteorite

Then in your project directory

mrt add bootstrap-3

For other plugins you can't find on atmosphere add the files into a directory in your project /client/lib. Meteor will automatically reference the files for you, both css and js.

This way they only run on the client side and are loaded first. (such as lightbox.js)

You might have to modify a few files with Meteor, though. In meteor each file's variables are file-scoped. So you can't access them from other files. (meteor basically throws a (function() {..}).call() around the code.

So if you get some kind of issue about a variable being undefined look for the variable and remove the var keyword and remove it so that the variable/method becomes global. With jquery plugins this usually isn't a problem.

Most that have the variable scoping issues are on http://atmosphere.com so you shouldn't run into too many problems.


The most common libraries such as jQuery and Bootstrap (v2.3.0) are provided by the Meteor core (v0.6.6.3). They can be listed using meteor list and included with meteor add.

As referred before, Atmosphere is a collection of unofficial Meteor packages giving an easy way with Meteorite to include even 3rd party solutions to your own project.

Moreover, you should learn the Meteor App structure. Directories created on your project have different preferences in terms of files visibility and loading order. I recommend reading Ritik Malhotra's presentation about the App structure at http://www.slideshare.net/RitikM/building-a-production-ready-meteor-app. There's also a Youtube video about his presentation that can be watched here http://www.youtube.com/watch?v=gfFGjmiKfnA.


Need Your Help

LNK2005 already defined error on inclusion of C-type header file in C++ project [MSVC12]

c++ linker-errors msvc12 lnk2005

I've hit a roadblock in attempting to integrate some third-party code in my project. I'm attempting to integrate fontstash, which is a header-only OpenGL text rendering solution. (https://github.com/

How to remove the circle in the background of the impress.js demo

css impress.js

I just checked out the impress.js demo and it seems to be a powerful tool.