ehynds / grunt-remove-logging

Grunt.js task for removing console logging statements
MIT License
192 stars 33 forks source link

Leaving blank lines isn't very pretty. #36

Open phreezer opened 9 years ago

phreezer commented 9 years ago

Leaving blank lines makes my code look like swiss cheese so I just added some changes to remove the blank lines that the script leaves behind. It's a quick fix for my situation where all my logs are single lines.

rConsole = new RegExp("(\r?\n|\r)?(\\s*)?(" + opts.namespace.join("|") + ")" + ".(?:" + opts.methods.join("|") + ")\\s{0,}\\([^;]*\\)(?!\\s*[;,]?\\s*\\/\\*\\s*RemoveLogging:skip\\s*\\*\\/)\\s{0,};?(\r?\n|\r)?", "gi");

src = src.replace(rConsole, function() {
    counter++;
    return opts.replaceWith || "\r\n";
});

Can an option to remove the line the log was on completely be added in future releases?