avoid angular dependencies download on bower install ionic
Hello,
If you are shipping a Ionic application on mobile and you love to use Bower then you probably encountered this problem.
Doing a simple
bower install ionic
cause Bower to install also “angular”, “angular-animate”, “angular-ui-router” and “angular-sanitize” dependencies.
This happens because Bower reads the bower.json
file of Ionic and find those modules listed under dependencies.
That’s normal but Ionic delivers all the required dependencies in his ionic.bundle.min.js
and so we don’t need them in the mobile package.
To fix this problem we have just to add a .bowerrc
file next to the bower.json
with this content:
{
"directory": "www/lib",
"ignoredDependencies": [
"angular",
"angular-animate",
"angular-ui-router",
"angular-sanitize"
]
}
NOTE: “directory” is pointed to “www/lib” in case of a Ionic application. By default it’s “bower_components”.
With these code snippet the dependencies you specify will be ignored when doing bower install or update.
The “ignoredDependencies” parameter is available since bower version 1.6.2!
That’s it!
Thank you for this clear info!
The shadow effect to the article is very satisfying. I like it very much.