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..b847b8c03 --- /dev/null +++ b/gulp-coffeeify/gulp-coffeeify.d.ts @@ -0,0 +1,44 @@ +// Type definitions for gulp-coffeeify +// Project: https://github.com/nariyu/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; +} +