From 1dbfd8a1641614248d3415dd319537d35f8cc9f0 Mon Sep 17 00:00:00 2001 From: tkQubo Date: Mon, 24 Aug 2015 19:50:57 +0900 Subject: [PATCH] Add gulp-coffeeify --- gulp-coffeeify/gulp-coffeeify-tests.ts | 53 ++++++++++++++++++++++++++ gulp-coffeeify/gulp-coffeeify.d.ts | 42 ++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 gulp-coffeeify/gulp-coffeeify-tests.ts create mode 100644 gulp-coffeeify/gulp-coffeeify.d.ts diff --git a/gulp-coffeeify/gulp-coffeeify-tests.ts b/gulp-coffeeify/gulp-coffeeify-tests.ts new file mode 100644 index 000000000..662428563 --- /dev/null +++ b/gulp-coffeeify/gulp-coffeeify-tests.ts @@ -0,0 +1,53 @@ +/// +/// + +import gulp = require('gulp'); +import coffeeify = require('gulp-coffeeify'); + +// Basic usage +gulp.task('scripts', function() { + gulp.src('src/coffee/**/*.coffee') + .pipe(coffeeify()) + .pipe(gulp.dest('./build/js')); +}); + +gulp.task('scripts', function() { + gulp.src('src/coffee/**/*.coffee') + .pipe(coffeeify({ + options: { + debug: true, // source map + paths: [__dirname + '/node_modules', __dirname + '/src/coffee'] + } + })) + .pipe(gulp.dest('./build/js')); +}); + +gulp.task('scripts', function() { + gulp.src('src/coffee/**/*.coffee') + .pipe(coffeeify({ + aliases: [ + { + cwd: 'src/coffee/app', + base: 'app' + } + ] + })) + .pipe(gulp.dest('./build/js')); +}); + +var xform = function(data: string){ + return 'module.exports = "' + data + '"'; +}; +gulp.task('scripts', function() { + gulp.src('src/coffee/**/*.coffee') + .pipe(coffeeify({ + transforms: [ + { + ext: '.extension', + transform: xform + } + ] + })) + .pipe(gulp.dest('./build/js')); +}); + diff --git a/gulp-coffeeify/gulp-coffeeify.d.ts b/gulp-coffeeify/gulp-coffeeify.d.ts new file mode 100644 index 000000000..e47f863ac --- /dev/null +++ b/gulp-coffeeify/gulp-coffeeify.d.ts @@ -0,0 +1,42 @@ +// Type definitions for gulp-coffeeify +// Project: gulp-coffeeify +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "gulp-coffeeify" { + namespace coffeeify { + interface Coffeeify { + (option?: Option): NodeJS.ReadWriteStream; + } + + interface Option { + options?: { + debug?: boolean; + paths?: string[]; + }, + /** + * [DEPRECATED]: You should use a 'paths' options of browserify. + */ + aliases?: Aliases; + /** + * [DEPRECATED] + */ + transforms?: Transforms; + } + + interface Aliases { + cwd?: string; + base?: string; + } + + interface Transforms { + ext?: string; + transform?(data: string): string; + } + } + + var coffeeify: coffeeify.Coffeeify; + + export = coffeeify; +} +