diff --git a/gulp-gzip/gulp-gzip-tests.ts b/gulp-gzip/gulp-gzip-tests.ts new file mode 100644 index 000000000..295e98b7f --- /dev/null +++ b/gulp-gzip/gulp-gzip-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +import gulp = require('gulp'); +import gzip = require('gulp-gzip'); + +gzip({ append: true }); + +gzip({ extension: 'zip' }); // note that the `.` should not be included in the extension + +gzip({ preExtension: 'gz' }); // note that the `.` should not be included in the extension + +gzip({ threshold: '1kb' }); + +gzip({ threshold: 1024 }); + +gzip({ threshold: true }); + +gzip({ gzipOptions: { level: 9 } }); + +gzip({ gzipOptions: { memLevel: 1 } }); + +gulp.task('compress', function() { + gulp.src('./dev/scripts/*.js') + .pipe(gzip()) + .pipe(gulp.dest('./public/scripts')); +}); diff --git a/gulp-gzip/gulp-gzip.d.ts b/gulp-gzip/gulp-gzip.d.ts new file mode 100644 index 000000000..8711153ed --- /dev/null +++ b/gulp-gzip/gulp-gzip.d.ts @@ -0,0 +1,47 @@ +// Type definitions for gulp-gzip +// Project: https://github.com/jstuckey/gulp-gzip +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-gzip" { + import zlib = require('zlib'); + + namespace gzip { + interface Gzip { + (options?: Options): NodeJS.ReadWriteStream; + } + + interface Options { + /** + * Appends .gz file extension if true. + * @default true + */ + append?: boolean; + /** + * Appends an arbitrary extension to the filename. Disables append and preExtension options. + */ + extension?: string; + /** + * Appends an arbitrary pre-extension to the filename. Disables append and extension options. + */ + preExtension?: string; + /** + * Minimum size required to compress a file. + * @default false + */ + threshold?: number|string|boolean; + /** + * Options object to pass through to zlib.Gzip. + * See zlib documentation for more information. + */ + gzipOptions?: zlib.ZlibOptions; + } + } + + var gzip: gzip.Gzip; + + export = gzip; +} +