From 41df70b20c0083dbd21ac99b74a109c0b3fd30f2 Mon Sep 17 00:00:00 2001 From: Jamison Greeley Date: Tue, 8 Dec 2015 19:05:04 -0700 Subject: [PATCH 1/3] Adds gulp-jade --- gulp-jade/gulp-jade-tests.ts | 29 +++++++++++++ gulp-jade/gulp-jade.d.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 gulp-jade/gulp-jade-tests.ts create mode 100644 gulp-jade/gulp-jade.d.ts diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts new file mode 100644 index 000000000..a2c7756d0 --- /dev/null +++ b/gulp-jade/gulp-jade-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +import * as gulp from 'gulp'; +import jade from 'gulp-jade'; + +gulp.task('jade', () => { + gulp.src('src/**/*.jade') + .pipe(jade()) + .pipe(gulp.dest('dist/')); +}); + +gulp.task('jade:pretty', () => { + gulp.src('src/**/*.jade') + .pipe(jade({ + pretty: '\t', + })) + .pipe(gulp.dest('dist/')) +}); + +gulp.task('jade:client', () => { + gulp.src('src/**/*.jade') + .pipe(jade({ + client: true, + pretty: true, + debug: false, + compileDebug: false, + })); +}); \ No newline at end of file diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts new file mode 100644 index 000000000..624b9a016 --- /dev/null +++ b/gulp-jade/gulp-jade.d.ts @@ -0,0 +1,83 @@ +// Type definitions for gulp-jade +// Project: https://github.com/phated/gulp-jade +// Definitions by: berwyn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "gulp-jade" { + export default function jade(params?: JadeParams): any; + + interface JadeParams { + + /******* + * JADE API OPTIONS + *******/ + + /** + * If the doctype is not specified as part of the + * template, you can specify it here. It is sometimes + * useful to get self-closing tags and remove mirroring + * of boolean attributes. + */ + doctype?: string; + + /** + * Adds whitespace to the resulting html to make it + * easier for a human to read using ' ' as indentation. + * If a string is specified, that will be used as + * indentation instead (e.g. '\t'). + */ + pretty?: any; + + /** + * Use a self namespace to hold the locals (false by default) + */ + self?: boolean; + + /** + * If set to true, the tokens and function body is logged + * to stdout + */ + debug?: boolean; + + /** + * If set to true, the function source will be included in the + * compiled template for better error messages (sometimes useful + * in development). It is enabled by default unless used with + * express in production mode. + */ + compileDebug?:boolean; + + /** + * If set to true, compiled functions are cached. filename + * must be set as the cache key. + */ + cache?:boolean; + + /******* + * GULP-JADE OPTIONS + *******/ + + /** + * Used to set a version of jade other than this library's + * dependency, or to customise filters. + */ + jade?: any; + + /** + * Compile to JS instead of HTML. + */ + client?: boolean; + + /** + * Locals to be used while parsing jade files. Takes + * precedence over data. + */ + locals?: any; + + /** + * Data to be used while parsing jade files. Has lower + * precedence than locals. + */ + data?: any; + } +} \ No newline at end of file From e9920407b96f37e0bcec3d6a8f8dfbb94073c497 Mon Sep 17 00:00:00 2001 From: Jamison Greeley Date: Tue, 8 Dec 2015 19:57:30 -0700 Subject: [PATCH 2/3] Fix for Typescript import syntax ES6 style syntax causes compiled code to function in unintended ways, leading to incorrect JavaScript code. --- gulp-jade/gulp-jade-tests.ts | 2 +- gulp-jade/gulp-jade.d.ts | 154 ++++++++++++++++++----------------- 2 files changed, 80 insertions(+), 76 deletions(-) diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts index a2c7756d0..d6077eae5 100644 --- a/gulp-jade/gulp-jade-tests.ts +++ b/gulp-jade/gulp-jade-tests.ts @@ -2,7 +2,7 @@ /// import * as gulp from 'gulp'; -import jade from 'gulp-jade'; +import * as jade from 'gulp-jade'; gulp.task('jade', () => { gulp.src('src/**/*.jade') diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts index 624b9a016..c5594a879 100644 --- a/gulp-jade/gulp-jade.d.ts +++ b/gulp-jade/gulp-jade.d.ts @@ -4,80 +4,84 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "gulp-jade" { - export default function jade(params?: JadeParams): any; - - interface JadeParams { - - /******* - * JADE API OPTIONS - *******/ - - /** - * If the doctype is not specified as part of the - * template, you can specify it here. It is sometimes - * useful to get self-closing tags and remove mirroring - * of boolean attributes. - */ - doctype?: string; - - /** - * Adds whitespace to the resulting html to make it - * easier for a human to read using ' ' as indentation. - * If a string is specified, that will be used as - * indentation instead (e.g. '\t'). - */ - pretty?: any; - - /** - * Use a self namespace to hold the locals (false by default) - */ - self?: boolean; - - /** - * If set to true, the tokens and function body is logged - * to stdout - */ - debug?: boolean; - - /** - * If set to true, the function source will be included in the - * compiled template for better error messages (sometimes useful - * in development). It is enabled by default unless used with - * express in production mode. - */ - compileDebug?:boolean; - - /** - * If set to true, compiled functions are cached. filename - * must be set as the cache key. - */ - cache?:boolean; - - /******* - * GULP-JADE OPTIONS - *******/ - - /** - * Used to set a version of jade other than this library's - * dependency, or to customise filters. - */ - jade?: any; - - /** - * Compile to JS instead of HTML. - */ - client?: boolean; - - /** - * Locals to be used while parsing jade files. Takes - * precedence over data. - */ - locals?: any; - - /** - * Data to be used while parsing jade files. Has lower - * precedence than locals. - */ - data?: any; + + function GulpJade(params?: GulpJade.Params): any; + + module GulpJade { + interface Params { + /******* + * JADE API OPTIONS + *******/ + + /** + * If the doctype is not specified as part of the + * template, you can specify it here. It is sometimes + * useful to get self-closing tags and remove mirroring + * of boolean attributes. + */ + doctype?: string; + + /** + * Adds whitespace to the resulting html to make it + * easier for a human to read using ' ' as indentation. + * If a string is specified, that will be used as + * indentation instead (e.g. '\t'). + */ + pretty?: any; + + /** + * Use a self namespace to hold the locals (false by default) + */ + self?: boolean; + + /** + * If set to true, the tokens and function body is logged + * to stdout + */ + debug?: boolean; + + /** + * If set to true, the function source will be included in the + * compiled template for better error messages (sometimes useful + * in development). It is enabled by default unless used with + * express in production mode. + */ + compileDebug?:boolean; + + /** + * If set to true, compiled functions are cached. filename + * must be set as the cache key. + */ + cache?:boolean; + + /******* + * GULP-JADE OPTIONS + *******/ + + /** + * Used to set a version of jade other than this library's + * dependency, or to customise filters. + */ + jade?: any; + + /** + * Compile to JS instead of HTML. + */ + client?: boolean; + + /** + * Locals to be used while parsing jade files. Takes + * precedence over data. + */ + locals?: any; + + /** + * Data to be used while parsing jade files. Has lower + * precedence than locals. + */ + data?: any; + } } + + export = GulpJade; } \ No newline at end of file From 41ef01998a31c0e5a2463c810fea5eb4216d1455 Mon Sep 17 00:00:00 2001 From: Jamison Greeley Date: Thu, 17 Dec 2015 15:29:24 -0700 Subject: [PATCH 3/3] gulp-jade -- better representation of `pretty` --- gulp-jade/gulp-jade.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts index c5594a879..221a14db0 100644 --- a/gulp-jade/gulp-jade.d.ts +++ b/gulp-jade/gulp-jade.d.ts @@ -27,7 +27,7 @@ declare module "gulp-jade" { * If a string is specified, that will be used as * indentation instead (e.g. '\t'). */ - pretty?: any; + pretty?: boolean|string; /** * Use a self namespace to hold the locals (false by default)