mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-02 00:00:04 +00:00
Add gulp-svgmin types (#25599)
This commit is contained in:
51
types/gulp-svgmin/gulp-svgmin-tests.ts
Normal file
51
types/gulp-svgmin/gulp-svgmin-tests.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import svgmin = require("gulp-svgmin");
|
||||
import { basename, extname } from "path";
|
||||
|
||||
// From tests
|
||||
|
||||
svgmin({ plugins: [] });
|
||||
svgmin({ plugins: [{ removeDoctype: false }] });
|
||||
svgmin({ plugins: [{ removeDoctype: false }, { removeComments: false }] });
|
||||
|
||||
// From examples given in README
|
||||
|
||||
// $ExpectType Transform
|
||||
svgmin();
|
||||
|
||||
// $ExpectType Transform
|
||||
svgmin({
|
||||
plugins: [{
|
||||
removeDoctype: false
|
||||
}, {
|
||||
removeComments: false
|
||||
}, {
|
||||
cleanupNumericValues: {
|
||||
floatPrecision: 2
|
||||
}
|
||||
}, {
|
||||
convertColors: {
|
||||
names2hex: false,
|
||||
rgb2hex: false
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
// $ExpectType Transform
|
||||
svgmin({
|
||||
js2svg: {
|
||||
pretty: true
|
||||
}
|
||||
});
|
||||
|
||||
// $ExpectType Transform
|
||||
svgmin(function getOptions(file) {
|
||||
const prefix = basename(file.relative, extname(file.relative));
|
||||
return {
|
||||
plugins: [{
|
||||
cleanupIDs: {
|
||||
prefix: prefix + '-',
|
||||
minify: true
|
||||
}
|
||||
}]
|
||||
};
|
||||
});
|
||||
17
types/gulp-svgmin/index.d.ts
vendored
Normal file
17
types/gulp-svgmin/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for gulp-svgmin 1.2
|
||||
// Project: https://github.com/ben-eb/gulp-svgmin
|
||||
// Definitions by: Aankhen <https://github.com/Aankhen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// (required because svgo specifies 2.2)
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import SVGO = require("svgo");
|
||||
import { Transform } from "stream";
|
||||
import * as File from "vinyl";
|
||||
|
||||
export = GulpSvgmin;
|
||||
|
||||
declare function GulpSvgmin(cb: (file: File) => SVGO.Options): Transform;
|
||||
declare function GulpSvgmin(options?: SVGO.Options): Transform;
|
||||
23
types/gulp-svgmin/tsconfig.json
Normal file
23
types/gulp-svgmin/tsconfig.json
Normal file
@@ -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-svgmin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/gulp-svgmin/tslint.json
Normal file
1
types/gulp-svgmin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user