我第一次尝试使用UglifyJS。我想使用UglifyJS转换下面的代码
function someFn(){
var someVar="test";
if(browser=="IE7"){
....
console.log("something");
console.log("somethingelse");
.....
}
else{
....
console.log("nothing");
console.log("nothingelse");
.....
}
}产出低于产出
function someFn(){
var someVar="test";
....
console.log("something");
console.log("somethingelse");
.....
}以下是我所尝试的
if (node instanceof UglifyJS.AST_If){
return node.body;
}但这提供的产出低于
function someFn(){
var someVar="test";
{
....
console.log("something");
console.log("somethingelse");
.....
}
}发布于 2013-08-12 09:38:02
UglifuJS提供了如下所示的方法
return UglifyJS.MAP.splice(node.body.body);以上代码将移除这些额外的大括号。
https://stackoverflow.com/questions/17907723
复制相似问题