mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-23 04:47:24 +08:00
Merge pull request #10798 from DanielRosenwasser/gulp-file-include
Added declarations and tests for 'gulp-file-include'.
This commit is contained in:
44
gulp-file-include/gulp-file-include-tests.ts
Normal file
44
gulp-file-include/gulp-file-include-tests.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import gulp = require("gulp");
|
||||
import fileinclude = require("gulp-file-include");
|
||||
|
||||
function testA() {
|
||||
fileinclude({
|
||||
prefix: "@@",
|
||||
basepath: "/home/"
|
||||
})
|
||||
}
|
||||
|
||||
function testB() {
|
||||
gulp.task("fileinclude", function () {
|
||||
gulp.src(["index.html"])
|
||||
.pipe(fileinclude({
|
||||
prefix: "@@",
|
||||
basepath: "@file"
|
||||
}))
|
||||
.pipe(gulp.dest("./"));
|
||||
});
|
||||
}
|
||||
|
||||
function testC() {
|
||||
gulp.task("fileinclude", function () {
|
||||
gulp.src(["index.html"])
|
||||
.pipe(fileinclude({
|
||||
filters: {
|
||||
markdown: (x) => "nope"
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest("./"));
|
||||
});
|
||||
}
|
||||
|
||||
function testD() {
|
||||
fileinclude({
|
||||
context: {
|
||||
arr: ["test1", "test2"]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testE() {
|
||||
fileinclude('@@');
|
||||
}
|
||||
38
gulp-file-include/index.d.ts
vendored
Normal file
38
gulp-file-include/index.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Type definitions for gulp-file-include 0.14.0
|
||||
// Project: https://github.com/coderhaoxin/gulp-file-include
|
||||
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare function fileinclude(prefix: string): NodeJS.ReadWriteStream;
|
||||
declare function fileinclude(opts: fileinclude.Options): NodeJS.ReadWriteStream;
|
||||
declare namespace fileinclude {
|
||||
export interface Options {
|
||||
/** default: "@@" */
|
||||
prefix?: string;
|
||||
/** default: "" */
|
||||
suffix?: string;
|
||||
/**
|
||||
* Can be "@file" or "@root" or some base path.
|
||||
* default: "@file"
|
||||
*/
|
||||
basepath?: "@file" | "@root" | string;
|
||||
/**
|
||||
* Filters basically look like functions that get passed into '@@include'.
|
||||
* When one of these functions is called, something of that name is looked
|
||||
* up in this object and called to get the contents of that include.
|
||||
*/
|
||||
filters?: { [filter: string]: (arg: any) => string };
|
||||
/**
|
||||
* Effectively a context for variables used in 'if' statements.
|
||||
*/
|
||||
context?: { [contextVarName: string]: any };
|
||||
/**
|
||||
* default: false
|
||||
*/
|
||||
indent?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = fileinclude;
|
||||
19
gulp-file-include/tsconfig.json
Normal file
19
gulp-file-include/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gulp-file-include-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user