UNPKG

grunt-remove-logging-calls

Version:

Grunt task to remove or replace all or any parts of logging statements from javascript code

20 lines (18 loc) 858 B
module.exports = function(grunt) { 'use strict'; grunt.registerMultiTask("removeLoggingCalls", "Remove all or any parts of logging statements", function() { var removeLoggingCalls = require("./lib/removeloggingcalls").init(grunt);; var options = this.options(); this.files.forEach(function(file) { file.src.filter(function(filepath) { if (!grunt.file.exists(filepath)) { grunt.log.warn('Source file "' + filepath + '" not found.'); } else { var sourceCode = grunt.file.read(filepath); var result = removeLoggingCalls.process(sourceCode, options.methods, options.strategy, options.removeSemicolonIfPossible); grunt.file.write(filepath, result); } }); }); }); };