I've got some web projetcs in Visual Studio 2013. Each web project has a debug and a release build profile.
How could I do to perform some cleaning of the JavaScript console.log("here is a log message") when the project is built (or after) ?
For information, I already use bundles with minification (from System.Web.Optimization).
Asked
Active
Viewed 1,590 times
2

bob
- 774
- 1
- 7
- 16
-
if the console.log statements are on the rasor view this answer might help http://stackoverflow.com/questions/4696175/razor-view-engine-how-to-enter-preprocessorif-debug – Sam.C Nov 17 '15 at 17:58
3 Answers
1
You should wrap console.log
in your application, so that you have fine grained control over logging at runtime.
That said, this is a dirty temporary hack:
debug && console.log('foo');
Where debug can be defined at runtime to start logging to the console.

Ben Aston
- 53,718
- 65
- 205
- 331
0
For me, I just do a "Find & Replace" on "console.log" to "//console.log".
If you use a minifier when deploying, it will strip the comments out to clean up the code.

I.Am.Me
- 203
- 4
- 8
0
VS CODE
Open the search option in the sidebar menu Type in console.log.*$

Soumitya Chauhan
- 359
- 3
- 6