I'm having a problem that when i run my task runner for my gulpfile, it targets all my .ts file correctly apart from resource.service.ts which seems to missed.
Below shows the files accepted and targeted by the gulp script:
- main.ts
- resource.ts
- resource-list.component.ts
- test.component.ts
- test.module.ts
The specific task referenced to target this .service.ts file is the app tasks.
Below is my gulp script:
//References to required plugins
var gulp = require("gulp"),
gp_clean = require('gulp-clean'),
gp_concat = require('gulp-concat'),
gp_sourcemaps = require('gulp-sourcemaps'),
gp_typescript = require('gulp-typescript'),
gp_uglify = require('gulp-uglify'),
gp_typescript_config = require('gulp-ts-config');
//Define source paths
var srcPaths = {
app: ['app/main.ts', 'app/**/*.ts'],
js: ['js/**/*.js',
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/typescript/lib/typescript.js']
, js_angular: ['node_modules/@angular/**']
, js_rxjs: ['node_modules/rxjs/**']
};
//Define destination paths
var destPaths = {
app: 'wwwroot/app/',
app_local: 'app/',
js: 'wwwroot/js/',
js_angular: 'wwwroot/js/@angular/',
js_rxjs: 'wwwroot/js/rxjs/'
};
//Compile, minifiy, and create sourcemaps for typescipt files and place them in wwwroot/app, together with the js.map files
gulp.task('app', function() {
return gulp.src(srcPaths.app)
.pipe(gp_sourcemaps.init())
.pipe(gp_typescript(require('./tsconfig.json').compilerOptions))
.pipe(gp_uglify({ mangle: false }))
.pipe(gp_sourcemaps.write('/'))
.pipe(gulp.dest(destPaths.app));
});
//Delete contents of wwwroot/app
gulp.task('app-clean', function () {
return gulp.src(destPaths.app + "*", { read: false })
.pipe(gp_clean({ force: true }));
});
//Copy js files from external libs to wwwroot/js
gulp.task('js', function () {
gulp.src(srcPaths.js_angular)
.pipe(gulp.dest(destPaths.js_angular));
gulp.src(srcPaths.js_rxjs)
.pipe(gulp.dest(destPaths.js_rxjs));
return gulp.src(srcPaths.js)
.pipe(gulp.dest(destPaths.js));
});
//Delete contents of wwwroot/js
gulp.task('js-clean', function () {
return gulp.src(destPaths.js + "*", { read: false })
.pipe(gp_clean({force: true }));
});
//Watch files and act on change
gulp.task('watch', function () {
gulp.watch([srcPaths.app, srcPaths.js], ['app', 'js']);
});
//Global clean
gulp.task('cleanup', ['app-clean', 'js-clean']);
//Default task
gulp.task('default', ['app', 'js', 'watch']);
For reference this is within Visual Studio 2017