Gulp plugin for angularjs-ts-class-annotate - the AngularJS Typescript class-only annotation library
MIT License
Gulp plugin which adds AngularJS dependency annotation for Typescript classes
Internally uses angularjs-ts-class-annotate library.
npm install --save-dev gulp-angularjs-ts-class-annotate
typescript@3 is a peer dependency, make sure to install it (if not have already):
npm install --save-dev typescript@3
const gulp = require("gulp");
const ngAnnotate = require("gulp-angularjs-ts-class-annotate");
gulp.task("annotate", function () {
return gulp.src("./src/**/*.ts")
.pipe(ngAnnotate())
.pipe(gulp.dest("annotated"));
});
After running gulp task, original typescript file
class Class1 {
constructor(private $log: ng.ILogService, private $window: ng.IWindowService) {
}
}
will be saved as:
class Class1 {
static $inject = ["$log","$window"];
constructor(private $log: ng.ILogService, private $window: ng.IWindowService) {
}
}
Full usage demo can be seeing here.
npm install
npm install typescript@3 --no-save
npm run demo