From e6347534e61b2e2a35480b772620561482bb5bcb Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 17 Apr 2014 10:44:36 +0800 Subject: [PATCH] Check the size of source files in the output file size check --- lib/tasks/check.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/tasks/check.js b/lib/tasks/check.js index c5ac67c..f3084e8 100644 --- a/lib/tasks/check.js +++ b/lib/tasks/check.js @@ -3,12 +3,21 @@ Copyright (c) 2012, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://yuilibrary.com/license/ */ +var fs = require('fs'); exports.check = function (options, blob, done) { - var bail = null; + var bail = null, + sourceFile; if (blob.result.length === 0) { - bail = 'writing zero length file from ' + blob.name; + if (blob.name) { + sourceFile = fs.readFileSync(blob.name, { + encoding: 'UTF-8' + }); + } + if (!blob.name || sourceFile.length !== 0) { + bail = 'writing zero length file from ' + blob.name; + } } done(bail, new blob.constructor(blob.result, blob));