Add Angular to the gulp build
Finally, we need to make sure that the Angular files are copied as part of the build. We need to add:
- The paths to the library files.
- Add a
lib
task to pipe the files towwwroot
. - Add a dependendency on
lib
to thedefault
task.
The updated gulpfile.js
should look like this:
/// <binding AfterBuild='default' Clean='clean' /> /* This file is the main entry point for defining Gulp tasks and using Gulp plugins. Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007 */ var gulp = require('gulp'); var del = require('del'); var paths = { scripts: ['scripts/**/*.js', 'scripts/**/*.ts', 'scripts/**/*.map'], libs: ['node_modules/angular2/bundles/angular2.js', 'node_modules/angular2/bundles/angular2-polyfills.js', 'node_modules/systemjs/dist/system.src.js', 'node_modules/rxjs/bundles/Rx.js'] }; gulp.task('lib', function () { gulp.src(paths.libs).pipe(gulp.dest('wwwroot/scripts/lib')) }); gulp.task('clean', function () { return del(['wwwroot/scripts/**/*']); }); gulp.task('default', ['lib'], function () { gulp.src(paths.scripts).pipe(gulp.dest('wwwroot/scripts')) });
Again, make sure that Task Runner Explorer sees the new lib
task after you save the gulpfile.
Please login to continue.