Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all console.log statements from your minified or combined javascript file

Iam using Visual studio

Iam having javascript codes scattered in different files.

Currently iam using below link's compressor

http://yuicompressor.codeplex.com/

this generates output as combined+minified files on project build.

i am looking for some way to remove all console.log statements from my codes in minified files. Please suggest me how to do this.

like image 513
Praveen Prasad Avatar asked Nov 15 '22 04:11

Praveen Prasad


1 Answers

Why not just do this:

window['console'] = { log: function() {} };

when you don't want the "console.log" statements to do anything?

like image 75
Pointy Avatar answered Dec 19 '22 22:12

Pointy