Visual Studio 2015 ASP.NET 5,Gulp 任务不从 node_modules 复制文件 [英] Visual Studio 2015 ASP.NET 5, Gulp task not copying files from node_modules
问题描述
我正在尝试更改从
这是文件结构:
我做错了什么,我该如何解决?非常感谢任何和所有帮助!
小疏忽...不幸的是,gulp 默默地创建了目录 webroot 并将文件复制到其中,它应该是 wwwroot.哎呀!!
///<binding BeforeBuild='copy-assets'/>使用严格";var _ = 要求('lodash'),吞咽 = 需要('吞咽');gulp.task('复制资产', function() {变资产 = {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));});});
:打孔:
I am attempting to alter a task runner script that I borrowed from here, however; after the task runner successfully executes in Visual Studio 2015's Task Runner Explorer -- the files are not actually copied.
Here is the altered script:
/// <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));
});
});
The task runner seems to run without error in Visual Studio 2015 Enterprise, but there are no files in my wwwroot/js or wwwroot/css afterwards?
Here is the file structure:
What am I doing wrong and how do I fix this? Any and all help is much appreciated!
Minor oversight... unfortunately gulp silently creates the directory webroot and copies the files into it, it should be wwwroot. Oops!!
/// <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));
});
});
:punch:
这篇关于Visual Studio 2015 ASP.NET 5,Gulp 任务不从 node_modules 复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!