From 896e63a46a28abc97071af127553197952980698 Mon Sep 17 00:00:00 2001 From: Liban Hassan Date: Wed, 24 May 2017 07:55:41 -0400 Subject: [PATCH 1/2] Update ts.ts --- tasks/ts.ts | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/tasks/ts.ts b/tasks/ts.ts index b5e5cfb3..d2304386 100644 --- a/tasks/ts.ts +++ b/tasks/ts.ts @@ -430,24 +430,29 @@ const pluginFn = function (grunt: IGrunt) { // local event to handle file event function handleFileEvent(filepath: string, displaystr: string, addedOrChanged: boolean = false) { - - // Only ts and html : - if (!utils.endsWith(filepath.toLowerCase(), '.ts') && !utils.endsWith(filepath.toLowerCase(), '.html')) { - return; - } - - // Do not run if just ran, behaviour same as grunt-watch - // These are the files our run modified - if ((new Date().getTime() - lastCompile) <= 100) { - // Uncomment for debugging which files were ignored - // grunt.log.writeln((' ///' + ' >>' + filepath).grey); - return; - } - - // Log and run the debounced version. - grunt.log.writeln((displaystr + ' >>' + filepath).yellow); - - filterFilesTransformAndCompile(); + + const acceptedExtentions = ['.ts', '.tsx', '.js', '.jsx', '.html']; + + acceptedExtentions.forEach( + (extension) => { + + // If extension is accepted and was not just run + if (utils.endsWith(filepath.toLowerCase(), extension) && (new Date().getTime() - lastCompile) > 100){ + + // Log and run the debounced version. + grunt.log.writeln((displaystr + ' >>' + filepath).yellow); + + filterFilesTransformAndCompile(); + + return; + } + + // Uncomment for debugging which files were ignored + // else if ((new Date().getTime() - lastCompile) <= 100){ + // grunt.log.writeln((' ///' + ' >>' + filepath).grey); + // } + } + ); } }).then((res: boolean[]) => { From df4a71eb24a10b22e70ec53ab7e258e3439b4712 Mon Sep 17 00:00:00 2001 From: Liban Hassan Date: Wed, 24 May 2017 08:08:49 -0400 Subject: [PATCH 2/2] Update ts.ts --- tasks/ts.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/ts.ts b/tasks/ts.ts index d2304386..b0580743 100644 --- a/tasks/ts.ts +++ b/tasks/ts.ts @@ -430,23 +430,23 @@ const pluginFn = function (grunt: IGrunt) { // local event to handle file event function handleFileEvent(filepath: string, displaystr: string, addedOrChanged: boolean = false) { - + const acceptedExtentions = ['.ts', '.tsx', '.js', '.jsx', '.html']; - + acceptedExtentions.forEach( (extension) => { - + // If extension is accepted and was not just run if (utils.endsWith(filepath.toLowerCase(), extension) && (new Date().getTime() - lastCompile) > 100){ - + // Log and run the debounced version. grunt.log.writeln((displaystr + ' >>' + filepath).yellow); filterFilesTransformAndCompile(); - + return; } - + // Uncomment for debugging which files were ignored // else if ((new Date().getTime() - lastCompile) <= 100){ // grunt.log.writeln((' ///' + ' >>' + filepath).grey);