When I create a new ASP.NET Core 1.0 application I want to use npm instead of bower. So I delete bower.json and additionally delete everything pre-installed in the wwwroot/lib folder.
I add a package.json file to my solution with the following dev dependencies:
"devDependencies": {
"bootstrap": "3.3.7",
"jquery": "3.1.0",
"jquery-validation": "1.15.1",
"jquery-validation-unobtrusive": "3.2.6"
}
However, NPM downloads all of the libraries to a node_modules folder in the root of my project.
I believe this is what Gulp is for. Can someone please tell me how I can use gulp to send the distribution files from node_modules to my wwwroot directory. If there are any tutorials out there that I was unable to find, please link.
Read this article https://wildermuth.com/2017/11/19/ASP-NET-Core-2-0-and-the-End-of-Bower I used this when I saw that there is bad support of bower in netcore 2.0
Do npm install xyz
or yarn install xyz
for each package in bower.json. Update gulp to copy stuff from node_modules
to lib
. Replace bower install
with npm install
or yarn install
in *.csproj
file.
Summary gulpfile:
var merge = require('merge-stream');
// Old bower behavior would be "*" in before and "" in after but you don't want that much.
var webpackages = {
"requirejs": {"bin/*": "bin/" }
// ...
}
gulp.task("dist_lib", function() {
var streams=[];
for (var package in webpackages)
for (var item in webpackages[package])
streams.push(gulp.src("node_modules/" + package + "/" + item)
.pipe(gulp.dest("lib/" + package + "/" + webpackage[package][item])));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With