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:
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