8

I am trying to move from Bower to NPM.

While I was using Bower, it was easy to configure the .bowerrc file and have the downloaded libraries in a directory such as wwwroot/lib

Now, I am developing a ASP.Net Core MVC app and trying to use NPM as my default package manager. By using Command Line in Visual Studio 2017, NPM creates package.json file and download libraries to node_modules folder. Then, what is next? How can I get JS or CSS files like I used to have in wwwroot/lib director?

Erdem M
  • 81
  • 2
  • https://webtooling.visualstudio.com/package-managers/npm/ – Ken Tucker Aug 27 '17 at 17:05
  • Thanks, but I already have NPM installed on my PC. The thing is how can I get JS or CSS files like in Bower in a directory such as wwwroot/lib director? (Currently, alI files I installed are in node_modules folder and I cannot use them in the project) – Erdem M Aug 27 '17 at 17:26

1 Answers1

1

Ok, so heres' the thing.

NPM: Node JS package manager, helps you to manage all the libraries your software relays on. You would define your needs in a file called package.json and run npm install in the command line... BANG your packages are downloaded and are ready to use. Could be used both for front-end and back-end.

resource: https://www.quora.com/What-are-the-differences-between-NPM-Bower-Grunt-Gulp-Webpack-Browserify-Slush-Yeoman-and-Express

Now, here's where NPM stops and his dear friend Gulp takes over. I can't type all of it, but to have your css and js files in a folder (and do whatever you want with them) you'll have to use an automation tool (I personally use Gulp but there's a bunch of them out there).

It's easy to set up and the documentation is here: https://gulpjs.com/

Gulp will basically be responsible of how and where your css files get compiled. It will base its requests for packages in the node_modules folder. So you're good to go. Configure gulp and you should be on your way.

There's also webpack. Never used it, but it seems to be the future of automation:

https://webpack.js.org/

I'd suggest using webpack.

Jabberwocky
  • 768
  • 7
  • 18