mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-11 11:50:54 +08:00
Adding a bunch of gulp utilities
This should allow a developer to write a gulpfile in TypeScript to compile a TypeScript project.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/// <reference path="./gulp-rename.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import rename = require("gulp-rename");
|
||||
|
||||
// rename via string
|
||||
gulp.src("./src/main/text/hello.txt")
|
||||
.pipe(rename("main/text/ciao/goodbye.md"))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/goodbye.md
|
||||
|
||||
// rename via function
|
||||
gulp.src("./src/**/hello.txt")
|
||||
.pipe(rename((path) => {
|
||||
path.dirname += "/ciao";
|
||||
path.basename += "-goodbye";
|
||||
path.extname = ".md"
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md
|
||||
|
||||
// rename via hash
|
||||
gulp.src("./src/main/text/hello.txt", { base: process.cwd() })
|
||||
.pipe(rename({
|
||||
dirname: "main/text/ciao",
|
||||
basename: "aloha",
|
||||
prefix: "bonjour-",
|
||||
suffix: "-hola",
|
||||
extname: ".md"
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for gulp-rename
|
||||
// Project: https://github.com/hparra/gulp-rename
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-rename" {
|
||||
interface Options {
|
||||
dirname?: string;
|
||||
basename?: string;
|
||||
prefix?: string;
|
||||
suffix?: string;
|
||||
extname?: string;
|
||||
}
|
||||
function rename(name: string): NodeJS.ReadWriteStream;
|
||||
function rename(callback: (path: Options) => any): NodeJS.ReadWriteStream;
|
||||
function rename(opts: Options): NodeJS.ReadWriteStream;
|
||||
export = rename;
|
||||
}
|
||||
Reference in New Issue
Block a user