gulp-typescript-closure-compiler v1.8.0
gulp-typescript-closure-compiler
A gulp plugin for handling typescript-closure-compiler compilation.
The current version is compatible with typescript-closure-compiler 1.8
.
For the purposes of clarity each npm package that will be released will match the major and minor version of typescript-closure-compiler
.
For example each version of gulp-typescript-closure-compiler
that is compatible with typescript-closure-compiler 1.7
will be constructed also 1.7.x and each version that is compatible with typescript-closure-compiler 1.8
will be constructed as 1.8.x
Installing
For the latest stable version:
npm install gulp-typescript-closure-compiler
or use it in the dependencies/devDependencies section of your package.json
"dependencies": {
"gulp-typescript-closure-compiler": "1.8.x"
}
Installing the latest version means that gulp-typescript-closure-compiler
will be dependent upon the latest version of typescript-closure-compiler 1.8
If you work with a specific version of typescript-closure-compiler (for instance 1.7), Then you need to install it globally using the @{version} after the gulp-typescript-closure-compiler
name:
npm install -g gulp-typescript-closure-compiler@1.7.x
or use it in the dependencies/devDependencies section of your package.json
"dependencies": {
"gulp-typescript-closure-compiler": "1.7.x"
}
Basic Usage
Import the library
var tscc = require("gulp-typescript-closure-compiler");
create the gulp-typescript-closure-compiler task
gulp.task('build-source', function () {
return gulp.src(['src/**/*.ts'])
.pipe(tscc({
exportAs: "App",
module: "commonjs",
entry: "src/app.ts",
noEmitOnError: true,
removeComments: true,
outFile: "built/output.js",
externsOutFile : "externs.js",
externs: [
"externs/app-externs.d.ts"
]
}));
});
Invoke the task
gulp build-source
This example will compile all TypeScript files in folder src
to a single closure compiler ready output file called output.js
in built
folder.
Using tsconfig.json
Import the library
var tscc = require("gulp-typescript-closure-compiler");
To use tsconfig.json
, you have to use tscc.createProject
:
var project = tscc.createProject(__dirname); //a directory containing a tsconfig.json
create the gulp-typescript-closure-compiler task
gulp.task('build-project', function () {
var project = tscc.createProject(__dirname);
return project.src()
.pipe(tscc(project));
});
Invoke the task
gulp build-project
Usage Examples
See an example using gulp-typescript-closure-compiler
plugin in the TSFunq project.
License
gulp-typescript-closure-compiler is licensed under the MIT license.