Staeff
Staeff

Reputation: 5084

What's the right way to use Bower in ASP.Net 5 and VS2015?

I currently try to get myself into ASP.Net 5 development, and I'm struggling to find the "way to go" for using Bower in this.

My project structure looks more or less like this:

testProject
  - wwwroot
      - index.html
  - bower_components (hidden by default in project.json)
      - angular
          - ...
      - ...
  - node_components  (hidden by default in project.json)
      - grunt
          - ...
      - ...
  - bower.json
  - Gruntfile.js
  - package.json
  - project.json
  - Startup.cs

I can't access bower_components in index.html and as it's not included in the project by default I guess it's meant this way.

So what's the expected way to work with the bower libraries?

I've seen many people are using grunt-bower-task to install the libraries once again into wwwroot/lib (or some other folder in the wwwroot), but this seems kind of redundant to me as Visual Studio already installs the packages into the project directory.

An alternative would be to use use grunt-copy to move the files from bower_components into the target folder, but with this way you would have to list every library you want to include once again.

So has anyone already gained some experience with this handling and would share how you are doing this?

Upvotes: 3

Views: 1334

Answers (1)

S Panfilov
S Panfilov

Reputation: 17541

Hmmm.. Didn't sure I understand the problem right, but anyway, if the problem just in bower destination folder, just add .bowerrc file to your root with content like:

{
    "directory" : "wwwroot/lib"
}

and after bower install command, bower will download libs in your dest folder

Upvotes: 6

Related Questions