mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 09:41:45 +00:00
[@types/gulp-imagemin] Update type definitions
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
import * as GulpImagemin from 'gulp-imagemin';
|
||||
import gulp = require('gulp');
|
||||
import gulpImagemin = require('gulp-imagemin');
|
||||
|
||||
GulpImagemin();
|
||||
const plugins = [
|
||||
gulpImagemin.gifsicle({ interlaced: true }),
|
||||
gulpImagemin.jpegtran({ progressive: true }),
|
||||
gulpImagemin.optipng({ optimizationLevel: 5 }),
|
||||
gulpImagemin.svgo({ floatPrecision: 2 })
|
||||
];
|
||||
|
||||
GulpImagemin([
|
||||
GulpImagemin.gifsicle({ interlaced: true }),
|
||||
GulpImagemin.jpegtran({ progressive: true }),
|
||||
GulpImagemin.optipng({ optimizationLevel: 5 }),
|
||||
GulpImagemin.svgo({
|
||||
plugins: [{ removeViewBox: true }, { cleanupIDs: false }]
|
||||
})
|
||||
]);
|
||||
|
||||
GulpImagemin({ verbose: true });
|
||||
|
||||
GulpImagemin([
|
||||
GulpImagemin.svgo({
|
||||
plugins: [{ removeViewBox: true }]
|
||||
})
|
||||
], { verbose: true });
|
||||
gulp.task('minify:img', () => {
|
||||
return gulp.src('img/**/*')
|
||||
.pipe(gulpImagemin())
|
||||
.pipe(gulpImagemin(plugins))
|
||||
.pipe(gulpImagemin({ verbose: true }))
|
||||
.pipe(gulpImagemin(plugins, { verbose: true }))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
Vendored
+13
-8
@@ -2,26 +2,31 @@
|
||||
// Project: https://github.com/sindresorhus/gulp-imagemin#readme
|
||||
// Definitions by: Romain Faust <https://github.com/romain-faust>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Plugin } from 'imagemin';
|
||||
import { Options as GifsicleOptions } from 'imagemin-gifsicle';
|
||||
import { Options as JpegtranOptions } from 'imagemin-jpegtran';
|
||||
import { Options as OptipngOptions } from 'imagemin-optipng';
|
||||
import { Options as SvgoOptions } from 'imagemin-svgo';
|
||||
import { Transform } from 'stream';
|
||||
|
||||
declare function imagemin(pluginsOrOptions?: imagemin.Plugin[] | imagemin.Options): Transform;
|
||||
declare function imagemin(plugins?: imagemin.Plugin[], options?: imagemin.Options): Transform;
|
||||
declare function imagemin(pluginsOrOptions?: ReadonlyArray<Plugin> | imagemin.Options): Transform;
|
||||
declare function imagemin(plugins?: ReadonlyArray<Plugin>, options?: imagemin.Options): Transform;
|
||||
|
||||
declare namespace imagemin {
|
||||
interface Options {
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
type Plugin = (input: any) => Promise<any>;
|
||||
type PluginFactory = (options?: any) => Plugin;
|
||||
type PluginFactory<T> = (options?: T) => Plugin;
|
||||
|
||||
const gifsicle: PluginFactory;
|
||||
const jpegtran: PluginFactory;
|
||||
const optipng: PluginFactory;
|
||||
const svgo: PluginFactory;
|
||||
const gifsicle: PluginFactory<GifsicleOptions>;
|
||||
const jpegtran: PluginFactory<JpegtranOptions>;
|
||||
const optipng: PluginFactory<OptipngOptions>;
|
||||
const svgo: PluginFactory<SvgoOptions>;
|
||||
}
|
||||
|
||||
export = imagemin;
|
||||
|
||||
Reference in New Issue
Block a user