question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular CLI and bower

See original GitHub issue

Hi everyone and sorry if it is not the right place to ask this.

I am currently working on a project with angular-cli, I can currently add files to the vendor folder using the ember-cli-build.js file. But I also need to use packages from bower in my project and it seems like currently angular-cli does not support this functionnality. I was wondering the bower support was in the roadmap or not at all ?

I managed to do what i want by modifying the angular2-app.js file and adding this:

Angular2App.prototype._getVendorNpmTree = function () {
  var vendorNpmFiles = [
    'systemjs/dist/system-polyfills.js',
    'systemjs/dist/system.src.js',
    'es6-shim/es6-shim.js',
    'angular2/bundles/angular2-polyfills.js',
    'rxjs/bundles/Rx.js',
    'angular2/bundles/angular2.dev.js',
    'angular2/bundles/http.dev.js',
    'angular2/bundles/router.dev.js',
    'angular2/bundles/upgrade.dev.js'
  ];

  if (this.options.vendorNpmFiles) {
    vendorNpmFiles = vendorNpmFiles.concat(this.options.vendorNpmFiles);
  }

  var vendorNpmTree = new Funnel('node_modules', {
    include: vendorNpmFiles,
    destDir: 'vendor'
  });

 /* added code to look for files in the bower_components folder */
  var bowervendorNpmTree = new Funnel('bower_components',{
     include:vendorNpmFiles,
     destDir: 'vendor' 
  });

  var assets = mergeTrees([vendorNpmTree,bowervendorNpmTree]);
  return assets;
};

Is this an acceptable way to do it ?

Thank you very much for your answers, Best Regards,

David

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
nosachamoscommented, Jun 17, 2016

Isn’t the .bowerrc a problem for prod builds? You definitely don’t want the whole bower_components in your production build, but instead just pick the css and js so they can be bundled, minified, etc.

Bower is still a very popular frontend package manager, and no doubt the simpler when it comes to managing conflicting versions of dependencies and packages. Ember cli is a huge success, entirely based on bower. IMHO skipping bower and relying entirely on npm is not a good move. NPM may become the best package manager for the frontend, but as of right now, for many workflows bower is still needed.

2reactions
filipesilvacommented, Mar 8, 2017

@praditha the CLI has changed a lot since this issue was first discussed. Nowadays to use bower libraries you shouldn’t need to configure the bower path.

Instead, add global scripts/styles as described in the following wiki pages:

Remember that this path is relative to your app root (usually src/), not to the project root.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bower install with angular-cli webpack - Stack Overflow
Here you can find guidelines to setup bower into an Angular CLI-generated application. Angular CLI - Bower setup.
Read more >
AngularJS - Intro to bower - Thinkster.io
Bower is a package manager for the web. To install angular,. bower install angular. Angular is grabbed from github. We get a bower_components...
Read more >
angular-cli vs bower vs grunt-cli vs webpack | npm trends
Comparing trends for .
Read more >
Learn Angular-cli, Bower and Dart - Egghead.io
Get Started with Dart · Generate components with the Angular CLI · Install the Angular CLI to Create and Serve an Angular Application...
Read more >
Bower — a package manager for the web
This is known as a flat dependency graph and it helps reduce page load. §Install Bower. Bower is a command line utility. Install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found