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 _ = 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:
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屋!