BrunoLM
BrunoLM

Reputation: 100322

How can I drop bower and use npm for client-side in ASP.NET Core 1.0?

I want to directly use npm to install jquery, bootstrap... and remove bower from my project.

What do I have to do for this to work?

Upvotes: 1

Views: 122

Answers (1)

janpieter_z
janpieter_z

Reputation: 1742

Remove the following two files from your project directory to prevent any dependency on bower packages. Visual Studio should empty out the wwwroot/lib folder (make sure this happened, otherwise remove manually).

.bowerrc    
bower.json

To use NPM modules you'll have to setup something like a gulp pipeline. This enables you to pick and choose, and combine it all. The built in bower integration has the (questionable) advantage of being in your wwwroot.

This should get you started: http://www.mikesdotnetting.com/article/283/asp-net-5-managing-client-side-dependencies-with-npm-bower-and-gulp (use a different location for the modules. You can require the specific pieces you want for the javascript if you don't want to reference the direct file location in the node_modules.

Upvotes: 2

Related Questions