diff --git a/lib/plato.js b/lib/plato.js index 59ec8a63..4f6e7397 100644 --- a/lib/plato.js +++ b/lib/plato.js @@ -100,15 +100,15 @@ exports.inspect = function(files, outputDir, options, done) { var fileShort = file.replace(commonBasePath, ''); var fileSafe = fileShort.replace(/[^a-zA-Z0-9]/g,'_'); - var source = fs.readFileSync(file).toString().trim(); - if (!source) { + var source = fs.readFileSync(file).toString(); + if (!source.trim()) { log.info('Not parsing empty file "%s"', file); return; } // if skip empty line option if(options.noempty) { - source = source.replace(/^\s*[\r\n]/gm ,""); + source = source.replace(/^\s*[\r\n]/gm ,"").trim(); } // if begins with shebang