Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让Bower安装GULP bundel库,ASP.Net 5_Gulp_Asp.net Core_Bower - Fatal编程技术网

如何让Bower安装GULP bundel库,ASP.Net 5

如何让Bower安装GULP bundel库,ASP.Net 5,gulp,asp.net-core,bower,Gulp,Asp.net Core,Bower,我使用新的Bower系统在ASP.NET5应用程序中安装了jQuery和jQuery验证。这是一个名为lib的文件夹,其中包含两个包的文件夹。在包的文件夹中有很多文件和子文件夹,在对其进行一些挖掘之后,我似乎只需要使用dist文件夹中的.js文件 我也在使用gulp进行捆绑和缩小,但我不确定如何配置它,以便它将从dist文件夹中添加文件以及我自己的自定义JavaScript文件 我对Gulp和Bower都很陌生,但到目前为止,它们看起来比旧的NuGet和ASP.Net 2.5捆绑和缩小方式更麻烦

我使用新的Bower系统在ASP.NET5应用程序中安装了
jQuery
jQuery验证
。这是一个名为
lib
的文件夹,其中包含两个包的文件夹。在包的文件夹中有很多文件和子文件夹,在对其进行一些挖掘之后,我似乎只需要使用
dist
文件夹中的
.js
文件

我也在使用
gulp
进行捆绑和缩小,但我不确定如何配置它,以便它将从
dist
文件夹中添加文件以及我自己的自定义
JavaScript
文件

我对
Gulp
Bower
都很陌生,但到目前为止,它们看起来比旧的
NuGet
和ASP.Net 2.5捆绑和缩小方式更麻烦、更烦人、更复杂

我的吞咽量(由VS2015为我生成): /// “严格使用”

编辑:
我刚刚添加了
jquery.validatie.unobtrusive
,它没有
dist
文件夹,只有一些
json
文件和包根目录下的核心
.js
文件,那么如何确保我在这里获取了所有正确的内容呢?

假设您的dist文件夹在webroot下:

path.dist=path.webroot+“dist/***.js”
..
任务(“min:js”,函数(){
返回gulp.src([paths.js,paths.dist,“!”+paths.minJs],{base:“.})


关键是要设置gulp从中提取文件的源文件夹。请注意,我已将my paths.dist添加到数组中?这会将该文件夹及其下的所有js文件添加到gulp中。如果需要其他文件夹,请将另一个属性添加到paths并将其添加到数组中。

我建议不要使用bower。大多数bower软件包都具有NPM等效项,甚至对于那些不使用package.json的,您可以引用git存储库。@MatthewRath我从来没有听说过NPM,我使用Bower是因为MS为您设置了它(我现在找不到它)我曾读到他们正在放弃对NuGet的支持……如果你使用NodeJS运行gulp,你怎么会不知道什么是NPM?@MatthewRath我在使用NodeJS吗?我不知道我只是右键单击gulp->Task Runner Explorer=>右键单击Clean/Min->Rungp是NodeJS的任务运行程序。NodeJS也有自己的烘焙依赖关系管理器,名为de>dist文件夹位于
wwwroot/lb/PackageName/dist
中,但现在在安装jquery.validate.unobtrusive之后,我发现该文件夹没有dist文件夹,它只位于包的根目录下
var gulp = require("gulp"),
    rimraf = require("rimraf"),
    concat = require("gulp-concat"),
    cssmin = require("gulp-cssmin"),
    uglify = require("gulp-uglify");

var paths = {
    webroot: "./wwwroot/"
};

paths.js = paths.webroot + "js/**/*.js";
paths.minJs = paths.webroot + "js/**/*.min.js";
paths.css = paths.webroot + "css/**/*.css";
paths.minCss = paths.webroot + "css/**/*.min.css";
paths.concatJsDest = paths.webroot + "js/site.min.js";
paths.concatCssDest = paths.webroot + "css/site.min.css";

gulp.task("clean:js", function (cb) {
    rimraf(paths.concatJsDest, cb);
});

gulp.task("clean:css", function (cb) {
    rimraf(paths.concatCssDest, cb);
});

gulp.task("clean", ["clean:js", "clean:css"]);

gulp.task("min:js", function () {
    return gulp.src([paths.js, "!" + paths.minJs], { base: "." })
        .pipe(concat(paths.concatJsDest))
        .pipe(uglify())
        .pipe(gulp.dest("."));
});

gulp.task("min:css", function () {
    return gulp.src([paths.css, "!" + paths.minCss])
        .pipe(concat(paths.concatCssDest))
        .pipe(cssmin())
        .pipe(gulp.dest("."));
});

gulp.task("min", ["min:js", "min:css"]);