Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove code between comments with grunt uglify

Is it possible to remove code between special comments with grunt uglify in javascript?

For example js code like this:

Source code:

var that = this;
var x=y;
//REMOVE-BEGIN
that.someCodeToBeRemoved();
that.someMoreCodeToBeRemoved();
//REMOVE-END
that.someFunctionCall();

What should be removed:

//REMOVE-BEGIN
that.someCodeToBeRemoved();
that.someMoreCodeToBeRemoved();
//REMOVE-END
like image 632
user3783327 Avatar asked Mar 17 '26 01:03

user3783327


1 Answers

You can use grunt-strip-code for this.

I don't think grunt uglify can do it.

like image 146
marton Avatar answered Mar 19 '26 15:03

marton