Add explanation how to selectively add files from a package
Closed this issue · 5 comments
I haven't found an explanation about how to include only parts of the included library's files.
In here it is done automatically, but in bower you manually include only what you need and not everything.
Thank you for this great library!
Good idea, don't know whether you can do this currently. PR welcome.
@Urigo, by default, meteor-bower automatically includes only the files listed in the main
section of package's bower.json
file. The other files will still present in their corresponding folder but not referenced anywhere in your app. (checkout the spec)
If you have a package without a main
section, you should manually reference the files you need.
Thanks @gbisheimer, I'll add that to the readme. Manually reference how? Eg if bower.json
is
{
"name": "foo",
"main": "lib/main.js"
}
and I want to reference extra/bar.js
, which lib/main.js
doesn't include, would I have to:
ln -s .meteor/local/bower/foo/extra/bar.js client/foo-bar.js
?
@lorensr Check out [https://github.com/MiroHibler/meteor-preloader]. I'm using this along with .bowerrc
in my project root to point the bower tool to install in the public/ folder, and manually referencing those CSS + JS files per route/controller.
Bower doesn't enforce the main
section in its packages, which means the only way to properly find out what's needed is to manual trawl through README and explicitly define what needs loading.
Unfortunately, through no fault of its own, it also means meteor-bower
is mostly useless simply because bower packages, by lack of strict loader references, are not guaranteed to have the parts needed to hook into the Meteor build process.
Thanks Lee, added that link to the readme.