diff --git a/types/gulp-minify/gulp-minify-tests.ts b/types/gulp-minify/gulp-minify-tests.ts new file mode 100644 index 0000000000..b438cd949b --- /dev/null +++ b/types/gulp-minify/gulp-minify-tests.ts @@ -0,0 +1,18 @@ +import * as gulp from 'gulp'; +import * as minify from 'gulp-minify'; + +gulp.task('minify-1', () => { + gulp.src('./src').pipe(minify()).pipe(gulp.dest('./out')); +}); + +gulp.task('minify-2', () => { + gulp.src('./src') + .pipe( + minify({ + preserveComments: 'all', + mangle: true, + ignoreFiles: ['file.js'], + }), + ) + .pipe(gulp.dest('./out')); +}); diff --git a/types/gulp-minify/index.d.ts b/types/gulp-minify/index.d.ts new file mode 100644 index 0000000000..01d8ba8bfd --- /dev/null +++ b/types/gulp-minify/index.d.ts @@ -0,0 +1,238 @@ +// Type definitions for gulp-minify 3.1 +// Project: https://github.com/hustxiaoc/gulp-minify +// Definitions by: Elias Skogevall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface minify { + (options?: Options): NodeJS.ReadWriteStream; +} + +interface Options { + /** + * An object that specifies output src and minified file extensions. + */ + ext?: { + /** + * The suffix string of the filenames that output source files ends with. + */ + src?: string; + + /** + * The suffix string of the filenames that output minified files ends with or the regex expressions to be replaced with input filenames. + */ + min?: string | string[]; + }; + + /** + * Will not minify files in the dirs. + */ + exclude?: string[]; + + /** + * If true, will not output the source code in the dest dirs. + */ + noSource?: boolean; + + /** + * Will not minify files which matches the pattern. + */ + ignoreFiles?: string[]; + + /** + * If true, will mangle variable names. + */ + mangle?: boolean; + + /** + * Pass an object if you wish to specify additional output options.The defaults are optimized for best compression. + */ + output?: { + /** + * Start indentation on every line (only when `beautify`) + */ + indent_start?: number; + + /** + * Indentation level (only when `beautify`) + */ + indent_level?: number; + + /** + * Quote all keys in object literals? + */ + quote_keys?: false; + + /** + * Add a space after colon signs? + */ + space_colon?: boolean; + + /** + * Output ASCII-safe? (encodes Unicode characters as ASCII) + */ + ascii_only?: boolean; + + /** + * Escape " boolean); +} + +declare var minify: minify; +export = minify; diff --git a/types/gulp-minify/tsconfig.json b/types/gulp-minify/tsconfig.json new file mode 100644 index 0000000000..5a73e3a4b8 --- /dev/null +++ b/types/gulp-minify/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-minify-tests.ts" + ] +} diff --git a/types/gulp-minify/tslint.json b/types/gulp-minify/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gulp-minify/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }