Alex Rivera | Logout

External dependencies (like bootstrap) in Meteor

Asked 2012-04-14T09:27:41.437
9

Let's say I have an external dependency like Bootstrap. I'd like to import some LESS from there, because that way I can use Bootstrap mixins in my code.

Since Meteor is already compiling and concatenating all of the LESS in my tree (right?), just copying the LESS directory and then manually updating it once in a while is not a solution. In fact, with the default LESS directory, it seems every LESS source file will appear in the output twice: once because it's imported in bootstrap.less, once because of the file itself.

Is there a way to get meteor to ignore some paths? public/ sounds close; but I don't really want to serve the bootstrap repo.

Plus, that might fix it for LESS, but what's the appropriate way to handle the JS extensions in bootstrap?

Edit
Report

1 Answer

0

From my experience, it's a bad idea to directly include the Bootstrap LESS files in a Meteor project:

  • It will make your development environment a lot slower, as many extra files need to be converted by Meteor and fetched by your browser.
  • It does not satisfy dependencies of third party packages that explicitly depend on the core bootstrap package. If you add one of those, you will end up with two bootstraps in your project.
  • Resources of packages are loaded earlier than project files. If you have an external package extending bootstrap, it's styling will be loaded before bootstrap.
  • Having to rename all imports to end with .lessimport makes it hard to keep up with newer bootstrap releases.
  • The order in which the bootstrap javascript files are loaded by Meteor (alphabetically) is incorrect, leading to Javascript errors that can only be fixed by renaming the files.

I created a shell script to generate a custom bootstrap Meteor package from either a precompiled distribution, or your own clone of the Bootstrap Git repository.

You can find it here, along with usage information: https://github.com/wojas/meteor-package-bootstrap

answered 2013-07-18T09:43:27.270

Your Answer