Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 ASP.NET 5, Gulp task not copying files from node_modules

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?

enter image description here

Here is the file structure:

enter image description here

What am I doing wrong and how do I fix this? Any and all help is much appreciated!

like image 375
David Pine Avatar asked Jan 06 '16 15:01

David Pine


1 Answers

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:

like image 141
David Pine Avatar answered Sep 29 '22 18:09

David Pine