Last active
August 29, 2015 14:05
-
-
Save cameron/e7d8430bc6c9a7ede461 to your computer and use it in GitHub Desktop.
ng-deps: the package manager manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"searchOrder": ["path/to/libs", "bower", "npm", "CDNs"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('moduleName') | |
.deps( | |
// look for underscore in all places specified by the searchOrder key in deps.json | |
'underscore', | |
// same as above, using semver (probably excludes CDN handling due to semver?) | |
['moment', '~1.0'], | |
// include jquery from npm | |
['jquery', '~2.1', 'npm'], | |
// incude lodash from bower | |
['lodash', '~1.4', 'bower'], | |
// this lib definitely lives at the URL | |
['someCDNLib', 'http://path/to/lib'], | |
// this lib is local, but doesn't live in the expected directory | |
['yall', 'override/deps.json/path']) | |
// let's get crazy + lazy | |
angular.module('anotherModule') | |
.deps.fromModule('moduleName').butDontForget('anotherLib') | |
// let's depend on some libs, and let's depend on a "parent" module to define the semvers/locations | |
angular.module('yam') | |
.deps('jquery', 'someCDNLib') | |
// nobody wants to touch this crusty old module | |
angular.module('old-school') | |
.deps(['jquery', '~0.8', 'npm']) // does not collide with the other version of jquery referenced above | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment