4

Current Meteor version:
Preview 0.6.6.3

I am tying to add client libraries in my Meteor project (on Ubuntu and also on Windows) with Meteor or meteorite, such as Taggle.js.
Those libraries are not available as packages on Atmosphere.

I tried to copy and paste my *.js in the .meteor/local/build/programs/client or .meteor/local/build/programs/client/app but it didn't work.

How can I put client-side native libraries in my Meteor project?

My current application structure:

my_app/

  • css/
  • pages/
  • js/
  • .meteor/
Kyll
  • 7,036
  • 7
  • 41
  • 64
Lombric
  • 830
  • 2
  • 11
  • 23

2 Answers2

18

You shouldn't manually mess with files in .meteor directory (except for packages and release files), that's where Meteor puts its compiled files. All libraries should go to source folder - so basically anywhere else.

I assume those are client-side libraries.

In that case, put them:

  • in /client if it doesn't matter when they are loaded and they happen to work there;
  • in /client/lib if you need to load them before the rest of the code;
  • in /client/compatibility if the code is not prepared to work with Meteor and you don't want to / don't know how to fix it;
  • in /client/lib/compatibility if both of the above conditions occur. I'd recommend to put them here on the beginning just to be safe.
Hubert OG
  • 19,314
  • 7
  • 45
  • 73
  • 1
    As of Meteor v1.0 only `client/compatibility` can be used for libraries that relies on global variables, `client/lib/compatibility` wraps global variable as file-local as any other Meteor project folder – physiocoder Dec 19 '14 at 18:11
  • I have edited the question, some phrasing in your answer may make a bit less sense ("_I assume those are client-side libraries._" for example, I made that clear in the question). – Kyll Dec 21 '15 at 22:38
1

If you want to load HTML/CSS/JS files dynamically to your meteor application then you can use: Meteor-external-file-loader

Add Meteor-external-file-loader to your meteor app by typing in console:

meteor add mrt:external-file-loader

Kuba Wyrobek
  • 5,273
  • 1
  • 24
  • 26
  • 1
    The latest commit to that project was two years ago and meteorite is effectively dead today. – Kyll Dec 21 '15 at 22:40