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:
Phips Peter
2015-01-28 17:23:29 -08:00
parent 338059f48e
commit 429c0c5c7d
26 changed files with 709 additions and 0 deletions
+29
View File
@@ -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
+20
View File
@@ -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;
}