Skip to content

Angular CLI and bower #397

@dgoexail

Description

@dgoexail

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions