npm - Visual Studio 2015 ASP.NET 5,Gulp 任务不从 node_modules 复制文件

标签 npm gulp asp.net-core angular asp.net-core-mvc

我正在尝试更改从 here 借来的任务运行器脚本, 然而;在任务运行器在 Visual Studio 2015 的任务运行器资源管理器 中成功执行后——实际上并未复制文件。

这是修改后的脚本:

/// <binding BeforeBuild='copy-assets' />
"use strict";

var _    = require('lodash'),
    gulp = require('gulp');

gulp.task('copy-assets', function() {
    var assets = {
        js: [
            './node_modules/bootstrap/dist/js/bootstrap.js',
            './node_modules/systemjs/dist/system.src.js',
            './node_modules/angular2/bundles/angular2.dev.js',
            './node_modules/angular2/bundles/router.dev.js',
            './node_modules/angular2/bundles/angular2-polyfills.js',
            './node_modules/angular2/bundles/http.dev.js',
            './node_modules/rxjs/bundles/Rx.js',
            './node_modules/typescript/lib/typescript.js'
        ],
        css: ['./node_modules/bootstrap/dist/css/bootstrap.css']
    };
    _(assets).forEach(function(assets, type) {
        gulp.src(assets).pipe(gulp.dest('./webroot/' + type));
    });
});

任务运行器似乎在 Visual Studio 2015 Enterprise 中运行没有错误,但在我的 wwwroot/jswwwroot/css 之后呢?

enter image description here

文件结构如下:

enter image description here

我做错了什么,我该如何解决?非常感谢任何帮助!

最佳答案

小疏忽......不幸的是,gulp 默默地创建了目录 webroot 并将文件复制到其中,它应该是 wwwroot。糟糕!!

/// <binding BeforeBuild='copy-assets' />
"use strict";

var _    = require('lodash'),
    gulp = require('gulp');

gulp.task('copy-assets', function() {
    var assets = {
        js: [
            './node_modules/bootstrap/dist/js/bootstrap.js',
            './node_modules/systemjs/dist/system.src.js',
            './node_modules/angular2/bundles/angular2.dev.js',
            './node_modules/angular2/bundles/router.dev.js',
            './node_modules/angular2/bundles/angular2-polyfills.js',
            './node_modules/angular2/bundles/http.dev.js',
            './node_modules/rxjs/bundles/Rx.js',
            './node_modules/typescript/lib/typescript.js'
        ],
        css: ['./node_modules/bootstrap/dist/css/bootstrap.css']
    };
    _(assets).forEach(function(assets, type) {
        gulp.src(assets).pipe(gulp.dest('./wwwroot/' + type));
    });
});

:打洞:

关于npm - Visual Studio 2015 ASP.NET 5,Gulp 任务不从 node_modules 复制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34636570/

相关文章:

javascript - Gulp v4 - 任务排序问题

c# - 请求 API 资源以外的范围时,ProfileDataRequestContext.RequestedClaimTypes 始终为 null?

c# - 在 C# 中的自定义验证属性中使用异步方法

c# - ASP.NET 核心 : Session Id Always Changes

node.js - Bower Install - 非法指令(核心转储)

html - 自定义库组件不是已知元素,但应用程序编译并运行

node.js - 输入任何命令后使用 npm 命令

unit-testing - Jasmine/PhantomJs 规范运行程序

node.js - npm 启动失败,events.js :174 throw err; on Ubuntu 18. 04

javascript - 如何打开新终端并使用 Gulp.js 运行命令