Currently, I am working on a project and have made the decision to utilize gulp for watching and transpiling Typescript files.
Below are the steps I followed to set everything up:
All of these actions were performed within the main directory of my project:
$ sudo npm update
$ npm -v #1.3.10
$ npm init #to generate the package.json file
$ sudo npm install gulp -g #installing gulp globally
$ gulp -v # When run, no version number is displayed.. why?
$ npm install gulp --save-dev
$ npm install gulp-typescript
$ vim gulpfile.js
The contents of my gulpfile.js are as follows:
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsProject = ts.createProject({
declaration: true,
noExternalResolve: true
});
gulp.task('scripts', function() {
return gulp.src('web/ts/*.ts')
.pipe(ts(tsProject))
.pipe(gulp.dest('web/js'))
});
gulp.task('watch', ['scripts'], function() {
gulp.watch('web/ts/*.ts', ['scripts']);
});
However, when I execute $ gulp scripts
, nothing happens. There is no error message either. What could be causing this issue?