gulp-typescript-closure-compiler
1.8.0 • Public • Publishedgulp-typescript-closure-compiler
A gulp plugin for handlingtypescript-closure-compiler compilation.
The current version is compatible withtypescript-closure-compiler 1.8
.
For the purposes of clarity each npm package that will be released will match the major and minor version oftypescript-closure-compiler
.
For example each version ofgulp-typescript-closure-compiler
that is compatible withtypescript-closure-compiler 1.7
will be constructed also 1.7.x and each version that is compatible withtypescript-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 thatgulp-typescript-closure-compiler
will be dependent upon the latest version oftypescript-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 thegulp-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 foldersrc
to a single closure compiler ready output file calledoutput.js
inbuilt
folder.
tsconfig.json
UsingImport the library
var tscc = require("gulp-typescript-closure-compiler");
To usetsconfig.json
, you have to usetscc.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 usinggulp-typescript-closure-compiler
plugin in theTSFunq project.
License
gulp-typescript-closure-compiler is licensed under theMIT license.
Package Sidebar
Install
npm i gulp-typescript-closure-compiler
Weekly Downloads
4
Version
1.8.0
License
MIT