From 76aa6875482df521368d3b97f8b098f44e73ce03 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 22 Apr 2016 17:23:25 -0500 Subject: [PATCH] Makes importl10n and server async gulp functions. --- external/importL10n/locales.js | 5 ++++- gulpfile.js | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/external/importL10n/locales.js b/external/importL10n/locales.js index 089209c4b..de0fa2729 100644 --- a/external/importL10n/locales.js +++ b/external/importL10n/locales.js @@ -82,10 +82,13 @@ function downloadLanguageFiles(root, langCode, callback) { }); } -function downloadL10n(root) { +function downloadL10n(root, callback) { var i = 0; (function next() { if (i >= langCodes.length) { + if (callback) { + callback(); + } return; } downloadLanguageFiles(root, langCodes[i++], next); diff --git a/gulpfile.js b/gulpfile.js index bf77da260..3bc39b871 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -51,7 +51,7 @@ gulp.task('default', function() { }); }); -gulp.task('server', function () { +gulp.task('server', function (done) { console.log(); console.log('### Starting local server'); @@ -80,7 +80,7 @@ gulp.task('makefile', function () { .pipe(gulp.dest('.')); }); -gulp.task('importl10n', function() { +gulp.task('importl10n', function(done) { var locales = require('./external/importL10n/locales.js'); console.log(); @@ -89,7 +89,7 @@ gulp.task('importl10n', function() { if (!fs.existsSync(L10N_DIR)) { fs.mkdirSync(L10N_DIR); } - locales.downloadL10n(L10N_DIR); + locales.downloadL10n(L10N_DIR, done); }); // Getting all shelljs registered tasks and register them with gulp