I want to write a small module/package that is supposed to work with FlowRouter. It can work with either kadira:flow-router or ostrio:flow-router-extra. How can I make it conditional on which package a project has installed?
I believe the recommended way to check for a meteor package is using the Package
global which acts as the package registry.
let FlowRouter;
if (Package['ostrio:flow-router-extra']) {
FlowRouter = Package['ostrio:flow-router-extra'].FlowRouter;
} else if (Package['kadira:flow-router']) {
FlowRouter = Package['kadira:flow-router'].FlowRouter;
}
It’s very quietly mentioned in the docs for weak dependencies here:
Brilliant. Check out my package jamgold:flow-animate-css
3 Likes
Very nice, I’d been looking for something like this!
Let me know if the sparse README is enough for you to get it working