From 51da9d6802e0321918961bda6fe92efb53edb13a Mon Sep 17 00:00:00 2001 From: Xevi Gallego Date: Tue, 15 Mar 2016 08:38:02 +0000 Subject: [PATCH] Fix the grunt task. Wait for all files to be written before finish the task. --- tasks/index.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tasks/index.js b/tasks/index.js index 4fefb2a..19e2f97 100644 --- a/tasks/index.js +++ b/tasks/index.js @@ -1,18 +1,8 @@ 'use strict'; var i18next = require('..'); -var through2 = require('through2'); var vfs = require('vinyl-fs'); -var tap = function(callback) { - return through2.obj(function(file, enc, done) { - if (typeof callback === 'function') { - callback(); - } - done(); - }); -}; - module.exports = function(grunt) { grunt.registerMultiTask('i18next', 'A grunt task for i18next-scanner', function() { var done = this.async(); @@ -23,9 +13,9 @@ module.exports = function(grunt) { vfs.src(target.files || target.src, {base: target.base || '.'}) .pipe(i18next(options, target.customTransform, target.customFlush)) .pipe(vfs.dest(target.dest || '.')) - .pipe(tap(function() { + .on('end', function() { done(); - })); + }); }); }); };